InterviewStack.io LogoInterviewStack.io

Advanced Problem Solving Techniques Questions

Master advanced techniques: binary search variants (finding boundaries, rotated arrays), greedy algorithms with justification for why greedy works, interval problems (merging, scheduling), and matrix problems (paths, rotations). Understand when each technique applies and when it doesn't. Know common gotchas: greedy doesn't always work (coin change is DP, not greedy), binary search requires specific properties, etc. Practice recognizing problem patterns that hint at specific techniques.

EasyTechnical
47 practiced
Implement binary search in Python: given a sorted ascending list of integers nums and an integer target, return the index of target or -1 if not found. Function signature: def binary_search(nums: List[int], target: int) -> int. Ensure O(log n) time and handle empty array and ordinary duplicates. Example: nums=[1,2,4,5,6], target=4 -> returns 2. Explain edge cases and show runtime and space complexity.
EasyTechnical
38 practiced
Check whether matrix B is a rotation of matrix A by a multiple of 90 degrees (Python): given two N x N matrices A and B, implement def is_rotation(A,B) -> bool that returns true if B equals A rotated by 0/90/180/270 degrees. Aim for clear code and O(n^2) time and O(1) extra space if possible.
MediumTechnical
47 practiced
Binary search on answer / Aggressive cows problem in Python: given stall positions (ints) and integer k (number of cows), place cows to maximize the minimum distance between any two cows. Implement def max_min_distance(stalls: List[int], k: int) -> int using binary search on distance and a feasible-check function. Explain correctness and complexity for up to 10^5 stalls.
MediumTechnical
77 practiced
Count number of intersecting interval pairs using sweep-line in C++: given N intervals, return the count of unordered pairs (i,j) that intersect. Implement an O(n log n) algorithm and discuss how to handle open vs closed interval endpoints and when the result may be very large.
MediumTechnical
42 practiced
Unique paths in a grid with obstacles (Python): given an m x n grid where 0 indicates empty and 1 indicates obstacle, compute number of unique paths from top-left to bottom-right moving only right or down. Implement def unique_paths_with_obstacles(grid: List[List[int]]) -> int and discuss time/space trade-offs and modulo when counts are large.

Unlock Full Question Bank

Get access to hundreds of Advanced Problem Solving Techniques interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.