All 57 questions

  1. What is recursion?

    Asked in 4 of 374 interviews · last asked Oct 6 · Concept · Junior

    Show answer

    Recursion is when a function calls itself to solve a smaller version of the same problem. A base case stops the calls. Each call must move toward that base case, and its result returns to the previous call.

    • The base case handles a simple input without another recursive call.
    • The recursive case reduces the problem and calls the function again.
    • Recursive calls usually use stack space; too many calls can cause a stack overflow.
    Python
    def factorial(n):
        if n < 0:
            raise ValueError("n must be nonnegative")
        if n == 0:
            return 1
        return n * factorial(n - 1)
    
    print(factorial(4))  # 24

    What the interviewer checks: The interviewer checks whether you understand self-calls, base cases, and why recursion stops.

    Other ways it was asked
    • “Can you explain recursion?”
    • “Can you explain to me how recursion works?”
    • “What is recursion, and how does it work?”
  2. Explain what dynamic programming is.

    Asked in 3 of 374 interviews · last asked Oct 9 · Concept · Junior

    Other ways it was asked
    • “What do you know about dynamic programming?”
    • “Why is dynamic programming useful, and when would you use it?”
  3. Give a problem suited to a greedy algorithm and explain why local choices produce an optimal solution.

    Asked in 3 of 374 interviews · last asked Sep 4 · Concept · Junior

    Other ways it was asked
    • “Can you provide a specific example where a greedy algorithm is effectively used?”
    • “Describe a problem where a greedy algorithm is appropriate. What makes choosing the best local option at each step effective?”
    • “Can you give an example of a problem suited to a greedy approach and explain why?”
  4. Why use dynamic programming for coin change, and how does it compare with recursive search?

    Asked in 2 of 374 interviews · last asked Sep 15 · Concept · Mid-level

    Other ways it was asked
    • “What is the significance of dynamic programming in solving the coin change problem as compared to a greedy approach?”
    • “Can you elaborate on how dynamic programming ensures finding the optimal solution in the coin change problem?”
    • “Why is dynamic programming appropriate for the coin-change problem, and what other approaches could you use?”
  5. Can you write a Python program to demonstrate dynamic programming?

    Asked in 2 of 374 interviews · last asked Jul 17 · Write code · Mid-level

    Other ways it was asked
    • “Give an example code that demonstrates dynamic programming in Python.”
  6. How could you systematically explore smaller subsets while checking that no selected elements are consecutive and no pair sums to 13?

    Asked once · last asked Jun 6 · Scenario · Junior

    Other ways it was asked
    • “How would you build a valid subset incrementally while ensuring that no selected elements are consecutive and no pair sums to 13?”
    • “How could you diagram possible subsets to check that no two selected elements are consecutive and no pair sums to 13?”
  7. How would you solve the N-Queens problem using reinforcement learning?

    Asked once · last asked Aug 13 · Scenario · Mid-level

  8. How would you solve the longest palindromic subsequence problem using dynamic programming?

    Asked once · last asked Aug 22 · Write code · Mid-level

  9. How would your integer-to-Roman-numeral conversion algorithm handle 700?

    Asked once · last asked Aug 31 · Write code · Junior

    Other ways it was asked
    • “How can an integer-to-Roman-numeral conversion algorithm handle values such as 3, 7, 4, and 9 without mapping every possible value individually?”
    • “How should an integer-to-Roman-numeral algorithm handle values that are multiples of 4 or 9, such as 40, 90, 400, and 900?”
    • “How would you handle 700 when converting integers to Roman numerals if your base values are 3, 7, 4, and 9?”
  10. Given the conditions of no consecutive elements and no pairs summing to 13, what patterns or smaller cases do you notice that could help simplify the problem?

    Asked once · last asked Jun 6 · Scenario · Junior

  11. How could you use examples with four or five numbers to test your approach to selecting a subset with no consecutive elements and no pair summing to 13?

    Asked once · last asked Jun 6 · Scenario · Junior

    Other ways it was asked
    • “What assumptions would you make when selecting a subset with no consecutive elements and no pair summing to 13, and how could testing them refine your approach?”
  12. Write a Python code example demonstrating a divide-and-conquer algorithm.

    Asked once · last asked Jul 17 · Write code · Junior

    Other ways it was asked
    • “Write a Python code example demonstrating the divide-and-conquer algorithm.”
  13. Write a Python function that flattens a nested dictionary into a flat format using dot-separated keys.

    Asked once · last asked Jul 24 · Write code · Mid-level

  14. How would you implement nested dictionary flattening iteratively, without recursion?

    Asked once · last asked Jul 24 · Write code · Mid-level

  15. Can you discuss the limitations of greedy algorithms or when they might not provide an optimal solution?

    Asked once · last asked Jul 27 · Concept · Junior

  16. In the activity selection problem with activities having start and finish times, what algorithm selects the maximum number of non-overlapping activities?

    Asked once · last asked Jul 27 · Concept · Junior

  17. Why does the greedy approach yield an optimal solution to the activity selection problem?

    Asked once · last asked Jul 27 · Concept · Junior

    Other ways it was asked
    • “Can you elaborate on why the greedy approach works best for the activity selection problem?”
  18. What are the necessary conditions for a problem to be solvable by a greedy algorithm?

    Asked once · last asked Jul 27 · Concept · Junior

  19. How can recursion be applied to generate permutations of a set?

    Asked once · last asked Jul 27 · Concept · Junior

  20. How would you handle duplicate elements in the input set while generating permutations?

    Asked once · last asked Jul 27 · Scenario · Mid-level

  21. How does divide and conquer affect time complexity as input size grows, and how does it compare with a straightforward algorithm?

    Asked once · last asked Aug 10 · Concept · Junior

  22. How would you use Redis to solve the N-Queens problem?

    Asked once · last asked Aug 13 · Scenario · Mid-level

  23. How would you convert 900 to a Roman numeral, and what steps would the algorithm take?

    Asked once · last asked Aug 31 · Write code · Junior

  24. Do you need to map every value individually when converting integers to Roman numerals, including values such as 900, 800, 700, 600, 400, 90, 80, and 70?

    Asked once · last asked Aug 31 · Write code · Junior

  25. How would you handle values such as 90 and other tens when converting integers to Roman numerals?

    Asked once · last asked Aug 31 · Write code · Junior

  26. Can you print all subsequences of the array [1, 2, 3]?

    Asked once · last asked Sep 10 · Write code · Junior

  27. Explain how the Fibonacci sequence is calculated, including its time complexity.

    Asked once · last asked Sep 13 · Concept · Junior

  28. What is the time complexity of the recursive Fibonacci algorithm: O(n²) or O(2^n)?

    Asked once · last asked Sep 13 · Concept · Junior

  29. Given an amount and coins of denominations 1, 5, 10, and 20, return the fewest coins possible and specify how many coins of each denomination are used.

    Asked once · last asked Sep 15 · Write code · Mid-level

  30. What test cases would you write to verify a coin-change function?

    Asked once · last asked Sep 15 · Write code · Mid-level

  31. How should a coin-change solution handle a negative amount, and how would you decide on that behavior?

    Asked once · last asked Sep 15 · Scenario · Mid-level

  32. Would adding a coin denomination such as 13 change your approach to the coin-change problem?

    Asked once · last asked Sep 15 · Scenario · Mid-level

  33. When would you decide that iterative loops are safer than recursion?

    Asked once · last asked Oct 6 · Concept · Junior

  34. How do you analyze the time and space complexity of a dynamic programming solution?

    Asked once · last asked Oct 11 · Concept · Mid-level

  35. In Elixir recursion, when do you use `when`, and what expressions can appear in a `when` guard?

    Asked once · last asked Oct 13 · Concept · Junior

  36. Can you explain the difference between two-dimensional and three-dimensional dynamic programming?

    Asked once · last asked Oct 15 · Concept · Junior

  37. Solve the Matrix Chain Multiplication problem.

    Asked once · last asked Oct 15 · Write code · Mid-level

  38. What does dp[i][j] represent in the Matrix Chain Multiplication problem?

    Asked once · last asked Oct 15 · Concept · Junior

  39. What is recursion, what are some examples of its use, and what problems can it solve?

    Asked once · last asked Jan 20 · Concept · Junior

  40. Can you implement a dynamic programming algorithm?

    Asked once · last asked Aug 17 · Write code · Junior

    Other ways it was asked
    • “Can you implement a dynamic programming algorithm and a divide-and-conquer algorithm?”
    • “Can you demonstrate a dynamic programming algorithm with an example?”
    • “Can you write a dynamic programming algorithm?”
  41. Can you tell me about top-down dynamic programming?

    Asked once · last asked Jul 13 · Concept · Junior

    Other ways it was asked
    • “What does top-down dynamic programming do?”
  42. For a subset selection problem where no two selected elements are consecutive and no pair sums to 13, what constraints must a valid subset satisfy?

    Asked once · last asked Jun 6 · Scenario · Junior

  43. How would you enforce the no-consecutive-elements constraint when selecting a subset?

    Asked once · last asked Jun 6 · Scenario · Junior

  44. How would you ensure that no two selected elements sum to 13 as you expand a subset?

    Asked once · last asked Jun 6 · Scenario · Junior

  45. Can you explain what the top-down approach in programming is?

    Asked once · last asked Jul 13 · Concept · Junior

  46. What is simulated annealing?

    Asked once · last asked Jul 13 · Concept · Junior

  47. Write a program demonstrating a divide-and-conquer algorithm.

    Asked once · last asked Jul 17 · Write code · Mid-level

    Other ways it was asked
    • “Write a program example for divide and conquer.”
  48. Explain LLMs and write a Python program demonstrating dynamic programming.

    Asked once · last asked Jul 17 · Write code · Junior

  49. Can you explain a simple example of where recursion could be useful?

    Asked once · last asked Jul 27 · Concept · Junior

  50. What challenges might you face when using recursion?

    Asked once · last asked Jul 27 · Concept · Junior

  51. Given a list of integers and a target value, can you write Python code to identify the integers that add up to the target?

    Asked once · last asked Aug 11 · Write code · Junior

  52. What is the N-Queens problem?

    Asked once · last asked Aug 13 · Concept · Junior

  53. Can you write pseudocode illustrating recursion?

    Asked once · last asked Aug 13 · Write code · Junior

    Other ways it was asked
    • “Can you give me the pseudocode of recursion?”
  54. Can you write a program using recursion?

    Asked once · last asked Aug 13 · Write code · Junior

  55. For the optimization problem, what does it mean if there is no feasible solution?

    Asked once · last asked Sep 3 · Concept · Mid-level

  56. What approach would you consider for the coin-change problem, and why?

    Asked once · last asked Sep 15 · Write code · Mid-level

  57. For a coin-change problem using denominations 1, 5, 10, and 20, what is the minimum-coin result for an amount of 26?

    Asked once · last asked Sep 15 · Write code · Junior

More Data Structures and Algorithms interview questions

How this list is made

Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.

Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.

The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Data Structures and Algorithms interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.

374 interviews, 269 candidates, Sep 2025 to Oct 2026. Updated every month with new interviews.