← All topics
Recursion & Backtracking Quiz: questions with answers
7 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What happens if a recursive function has no base case?
- Q2. What does this print? (code)
- Q3. How many subsets does a set of 4 distinct elements have?
- Q4. What are the three steps of the backtracking template?
- Q5. Why must you append a COPY of path (path[:] / new ArrayList<(path)) to the results?
- Q6. Naive recursive Fibonacci fib(n) = fib(n−1) + fib(n−2) has roughly what time complexity?
- Q7. To avoid duplicate combinations when the input has repeated numbers (Subsets II), you… (select all that apply)