gitGood.dev

Algorithm Interview Questions

Strengthen your algorithm skills with practice questions covering sorting, searching, dynamic programming, graph algorithms, and common problem-solving patterns.

77
Total Questions
12
Easy
46
Medium
19
Hard
Showing 1-20 of 77 questionsPage 1 of 4
Sign up to start practicing these questionsSign up free →
Sorting Algorithm Stability
QuizEasy
Dynamic Programming Recognition
QuizMedium
Shortest Path Algorithm Selection
QuizMedium
Time Complexity Analysis
QuizHard
Binary Search Application
QuizMedium
Two Pointer Technique
QuizEasy
Recursion vs Iteration
QuizMedium
Greedy vs Dynamic Programming
QuizHard
Sliding Window Technique
QuizMedium
Backtracking Algorithm
QuizHard
JavaScript Event Loop
QuizMedium
JavaScript Closures
QuizMedium
JavaScript 'this' Binding
QuizHard
TypeScript Generics
QuizMedium
React Hooks Rules
QuizEasy
React useEffect Dependencies
QuizMedium
React Virtual DOM
QuizMedium
React State Immutability
QuizEasy
Merge Sort Analysis
QuizMedium
BFS for Shortest Path
QuizMedium
...

Frequently Asked Questions

What algorithm topics appear most in interviews?

Binary search, BFS/DFS, dynamic programming, two pointers, sliding window, and sorting algorithms are the most common. Companies also test recursion, backtracking, and greedy algorithms frequently.

How do I get better at dynamic programming?

Start with simple DP problems like Fibonacci and climbing stairs. Learn to identify overlapping subproblems and optimal substructure. Practice both top-down (memoization) and bottom-up (tabulation) approaches, and build up to 2D DP problems.

What is the two-pointer technique?

Two pointers use two indices that move through an array to solve problems in O(n) time instead of O(n^2). Common applications include finding pairs that sum to a target, removing duplicates, and merging sorted arrays. It works best on sorted data or linked lists.

When should I use BFS vs DFS?

Use BFS for shortest path in unweighted graphs, level-order traversal, and finding nearest neighbors. Use DFS for detecting cycles, topological sorting, path finding in mazes, and problems requiring exhaustive search. BFS uses more memory (queue) while DFS uses the call stack.

How do I recognize which algorithm pattern to use?

Look for clues: 'find minimum/maximum' often means binary search or DP, 'all combinations/permutations' means backtracking, 'shortest path' means BFS or Dijkstra, 'contiguous subarray' means sliding window, and 'optimal substructure' means dynamic programming.

How important is knowing Big O complexity for interviews?

Essential. You are expected to analyze time and space complexity for every solution. Interviewers will ask you to optimize from brute force to efficient solutions. Understand O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n) and when each applies.

Explore Other Categories