InterviewStack.io LogoInterviewStack.io

Intermediate Algorithm Problem Solving Questions

Practical skills for solving medium difficulty algorithmic problems. Topics include two pointer techniques, sliding window, variations of binary search, medium level dynamic programming concepts such as recursion with memoization, breadth first search and depth first search on graphs and trees, basic graph representations, heaps and priority queues, and common string algorithms. Emphasis is on recognizing problem patterns, constructing correct brute force solutions and then applying optimizations, analyzing trade offs between time and space, and practicing systematic approaches to reach optimal or near optimal solutions.

EasyTechnical
19 practiced
Given a string, find the first non-repeating character and return its index; return -1 if none exists. Implement in O(n) time using appropriate data structures and discuss considerations for Unicode/multi-byte characters and case-sensitivity. Example: s = "leetcode" -> return 0; s = "loveleetcode" -> return 2.
EasyTechnical
21 practiced
Given two sorted singly linked lists, merge them into a single sorted list and return its head. Implement the iterative solution with O(1) extra space and O(n+m) time, and discuss the recursive alternative and potential stack depth implications. Example input lists: 1->2->4 and 1->3->4 -> result 1->1->2->3->4->4.
MediumTechnical
24 practiced
Given an integer array (which may include negative numbers) and an integer k, implement an algorithm to count the number of contiguous subarrays whose sum equals k. Aim for O(n) time using prefix sums and a hashmap; provide code and discuss handling very large arrays and integer overflow risks.
MediumTechnical
25 practiced
Given a string containing parentheses and letters, remove the minimum number of invalid parentheses to make the input valid and return all possible valid results. Implement BFS or DFS with careful pruning and memoization to avoid duplicates; explain why BFS gives the minimal removal. Discuss complexity and provide code outline.
MediumTechnical
22 practiced
Given an m x n grid where some cells are obstacles, compute the number of unique paths from the top-left corner to the bottom-right corner moving only right or down. Implement a DP solution, show how to optimize space to O(n), and discuss edge cases when start or end cells are blocked. Example grids and constraints should be covered.

Unlock Full Question Bank

Get access to hundreds of Intermediate Algorithm Problem Solving interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.