Data Structures & AlgorithmsVery hardGATE CS · TCS NQT
A frog at 0 wants to reach exactly 12 by jumps of length 2 or 3 to the right. How many different jump sequences take it there?
- A. 13
- B. 14
- C. 12
- D. 16
Correct answer: C. 12
Let f(x) be the number of sequences reaching x; f(x) = f(x-2) + f(x-3), with ordering mattering since each sequence differs in its steps.
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
- Using the pancake operation (reverse any prefix of length at least 2), what is the minimum number of operations to sort the array [3, 1…
- What is the minimum number of coins needed to make 63 from the denominations 1, 5, 10, 21 and 25 (unlimited supply of each)?
- What is the length of the longest strictly increasing subsequence of [10, 9, 2, 5, 3, 7, 101, 18]?
- How many valid balanced bracket strings with 3 pairs begin with an opening bracket and are balanced, where the string has exactly 6…
- Which algorithm computes the length of the longest increasing subsequence in O(n log n) time?
- To count distinct values in every window of size k of an array in O(n) total time, which structure is most suitable?