AIInterviewTraining logoAIInterview/Training

recursion

AI, ML & GenAI interview questions tagged recursion, across every topic.

10 questions · 0 unlocked for you

Concepts behind "recursion"

The curriculum that explains the ideas these questions test.

Foundational
💻 Coding & Engineering Craft
Recursion and Divide-and-ConquerRecursion solves a problem by calling itself on smaller inputs until a base case halts it; divide-and-conquer is the variant that breaks input into independent subproblems, solves each, and merges the results (merge sort, quickselect). Interviews test it because clean base-case-plus-recursive-step reasoning, an honest read of the call stack, and the bridge from recursion to memoization and dynamic programming separate people who can decompose problems from those who only pattern-match loops.
Core
💻 Coding & Engineering CraftSign in
Trees, BSTs, and TraversalA binary tree connects each node to at most two children, and a binary search tree adds the invariant that everything left is smaller and everything right is larger, which yields O(log n) search on a balanced tree. The traversal skills interviews check are the three depth-first orders (pre, in, post), breadth-first level order, and moving between recursion and an explicit stack. Applied-AI interviews test this because in-order traversal of a BST produces sorted output, and the recursion-to-stack conversion is the same skill behind iterative DFS everywhere.
Core
💻 Coding & Engineering CraftSign in
BacktrackingBacktracking is systematic search across a tree of partial solutions: at each step you pick an option, explore deeper, and undo the pick before trying the next (choose, explore, unchoose). Pruning cuts branches that cannot reach a valid solution before you spend work on them. Interviews test it because permutations, combinations, subsets, and constraint problems (N-queens, sudoku) all share this template, and the in-place choose/unchoose pattern avoids re-allocating state at every node, which is the difference between an elegant solution and an exponential memory blowup.