Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
A robot moves from the top-left to the bottom-right of a 4 × 5 grid of cells, each step going right, down, or diagonally down-right. How many such paths exist?
- A. 41
- B. 146
- C. 129
- D. 35
Correct answer: C. 129
Each cell's count is the sum of the three predecessors (above, left, and above-left diagonal). Counting only right and down moves gives C(R+C−2, R−1), which is a different count.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- A gold mine is the grid [[1, 3, 3], [2, 1, 4], [0, 6, 4]]. You start in any cell of the LEFT column and move one column to the right each…
- How many permutations of 0, 1, 2, 3, 4 are alternating, meaning p[0] < p[1] > p[2] < p[3] > p[4]?
- What is the smallest positive integer x such that x! (x factorial) ends with at least 1000 zeros?
- How many substrings of "abcabcb" contain at least one each of the letters a, b and c?
- What is the length of the shortest substring of "aabcbcdbca" that contains every distinct letter appearing in the whole string at least…
- How many contiguous subarrays of [4, 2, 3, 1, 6, 5, 7, 9] satisfy max − min = (length of the subarray) − 1? Count every such subarray…