Interview practice: Python
Classic coding-interview problems, from arrays and hash maps to sliding windows and dynamic programming. Solve them in Python, with tests that check the edge cases.
Premium The problems in this track are part of Premium. See Premium
Start the track- Two sum IntermediatePremiumFind the two numbers in a list that add up to a target, in a single pass.15 min
- Valid parentheses IntermediatePremiumDecide whether every bracket in a string is closed in the right order, using a stack.15 min
- Search insert position IntermediatePremiumUse binary search to find where a number is, or where it belongs, in a sorted list.15 min
- Group anagrams AdvancedPremiumPut words made of the same letters into groups, using a dictionary with a clever key.20 min
- Maximum subarray AdvancedPremiumFind the largest sum of a run of neighbouring numbers in one pass with Kadane's algorithm.20 min
- Merge intervals AdvancedPremiumCombine overlapping time ranges into the smallest list of ranges, after sorting them.20 min
- Top k frequent elements AdvancedPremiumCount how often each number appears and return the k most common, in a fixed order.20 min
- Longest substring without repeats ExpertPremiumSlide a window along a string to find the longest stretch with no repeated character.25 min
- Coin change ExpertPremiumFind the fewest coins that make an amount, with dynamic programming that beats the greedy guess.25 min
- Longest increasing subsequence ExpertPremiumMeasure the longest rising sequence hidden in a list, in O(n log n) with binary search.30 min