InterviewStack.io LogoInterviewStack.io

Common Interview Problem Patterns Questions

Familiarize yourself with typical problem patterns: string manipulation (finding substrings, counting characters), array operations (finding duplicates, sorting, searching), two-pointer techniques, basic recursion, and simple dynamic programming. Focus on problems that are LeetCode Easy to Easy-Medium difficulty.

HardTechnical
55 practiced
Coin Change (Minimum Coins): Given an integer amount and a list of coin denominations, compute the fewest number of coins needed to make up that amount, or return -1 if not possible. Implement coinChange(coins, amount) in Python using dynamic programming (bottom-up) with O(amount * len(coins)) time. Discuss when BFS can be used as an alternative and trade-offs between methods.
MediumTechnical
62 practiced
Valid Parentheses: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Implement isValid(s) in Python using a stack with O(n) time and O(n) space. Example: s='()[]{}' -> true, s='(]' -> false. Explain why a stack is the appropriate data structure.
MediumTechnical
75 practiced
Simplify Unix-style paths: Given a string path representing an absolute path (starting with '/'), simplify it to the canonical path. Implement simplifyPath(path) in Python considering '.' and '..' and removing extra slashes. Example: '/a/./b/../../c/' -> '/c'. Explain use of stack to solve the problem and describe edge cases.
EasyTechnical
66 practiced
Merge two sorted arrays nums1 and nums2 into one sorted array in-place. You are given nums1 with size m+n where the first m elements are valid and the last n elements are zeros reserved for merging, and nums2 with n elements. Implement merge(nums1, m, nums2, n) in Java or C++ in O(m+n) time and O(1) extra space. Example: nums1=[1,2,3,0,0,0], m=3; nums2=[2,5,6], n=3 -> nums1 becomes [1,2,2,3,5,6].
HardTechnical
114 practiced
Longest Consecutive Sequence: Given an unsorted array of integers, find the length of the longest consecutive elements sequence in O(n) time. Implement in Python using a hash set and explain why you only start counting at numbers that are sequence starts (num-1 not present). Example: [100,4,200,1,3,2] -> 4 (sequence 1,2,3,4).

Unlock Full Question Bank

Get access to hundreds of Common Interview Problem Patterns interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.