The first question is very simple, a straightforward one.
For the second question about the sliding window, given an integer n and a window size k, find how many distinctive consecutive sub-integers can be divided by n. (For example, if n = 120 and k = 2, then 12 and 20 can be divided by 120.)
The third question involves a matrix and requires a sorted query for an array. The format of the sort query is [x, y, w], where w represents a w x w size sub-matrix; x, y represent the coordinates starting from the top left corner. The matrix alternates between black and white cells. Each query needs to ensure that within the sub-matrix, the black cells and white cells are in ascending order.
The fourth question requires you to write a helper function rev() that reverses the input number. For example, rev(100) = 1, rev(123) = 321, rev(12300) = 321. Then, given an array and numbers i, j (i <= j), you need to determine how many (i, j) pairs satisfy the condition arr[i] + rev(arr[j]) == arr[j] + rev(arr[i]).
Thank you for your help.