## Covering the stains

There is a huge blanket on your bed but unfortunately it has N stains. You cover them using a single, rectangular silk cloth. The silk is expensive, which is why the rectangular piece needs to have the least area as possible. You love this blanket and decide to minimize the area covering the stains. You buy some cleaning liquid to remove the stains but sadly it isn't enough to clean all of them. You can just remove exactly K stains. The rest of the stains need to be covered using a single, recta

View Solution →## GCD Matrix

Alex has two arrays defined as A = [a0,a1,...,an-1] and B = [b0,b1,...,bm-1]. He created an n*m matrix, M, where Mij = gcd(ai,bj) for each i,j in M. Recall that gcd(a,b) is the greatest common divisor of a and b. For example, if A= [2,3] and b = [5,6], he builds M = [[1,2], [1,3]] like so: Alex's friend Kiara loves matrices, so he gives her q questions about matrix M where each question is in the form of some submatrix of M with its upper-left corner at M(r1,c1) and its bottom-right corner

View Solution →## Fairy Chess

Let's play Fairy Chess! You have an n*n chessboard. An s-leaper is a chess piece which can move from some square (x0,y0) to some square (x1,y1) if abs(x0-x1) + abs(y0-y1) <= s; however, its movements are restricted to up, down, left, and right within the confines of the chessboard, meaning that diagonal moves are not allowed. In addition, the leaper cannot leap to any square that is occupied by a pawn. Given the layout of the chessboard, can you determine the number of ways a leaper can mo

View Solution →## Suffix Rotation

Megan is playing a string game with the following rules: It starts with a string, s. During each turn, she performs the following move: Choose an index in s. The chosen index must be strictly greater than any index chosen in a prior move. Perform one or more circular rotations (in either direction) of the suffix starting at the chosen index. For example, let's say s = abcdefjghi. During our move, we choose to do three right rotations of the suffix starting at index 6: image Note that

View Solution →## New Year Present

Nina received an odd New Year's present from a student: a set of n unbreakable sticks. Each stick has a length, l, and the length of the ith stick is li-1. Deciding to turn the gift into a lesson, Nina asks her students the following: How many ways can you build a square using exactly 6 of these unbreakable sticks? Note: Two ways are distinct if they use at least one different stick. As there are (n,6) choices of sticks, we must determine which combinations of sticks can build a square.

View Solution →