You are given a list of rectangles, each represented by its width and height. Two rectangles are interchangeable if their width-to-height ratios are the same. Your task is to return the number of interchangeable rectangle pairs in the list.
You are given a stream of 2D points on the XY-plane. Your task is to design an algorithm that adds new points into a data structure and counts how many sets of three points, along with a given query point, can form an axis-aligned square. An axis-aligned square is a square where the edges are parallel or perpendicular to the X-axis and Y-axis, with all sides of equal length.
You are given an array of digit strings nums and a target digit string target. Count the number of valid pairs of indices (i, j) where i != j such that the concatenation of nums[i] and nums[j] equals target.
Alice and Bob are playing a game with stones. The sequence of n stones has values given in an array stones. Players take turns to remove a stone. The player who removes a stone, making the sum of all removed stones divisible by 3, loses. If all stones are removed, Bob wins automatically. Determine if Alice wins or Bob wins, assuming both play optimally.