Interview Coding
Everything on SkillVeris tagged Interview Coding — collected across the glossary, study notes, blog, and cheat sheets.
5 resources across 1 library
Interview Questions(5)
How Do You Solve the Three Sum Problem?
Sort the array, fix one element at a time, then use a two-pointer sweep on the remaining subarray to find pairs that sum to the negative of the fixed element,…
How Do You Solve the Four Sum Problem?
Sort the array, then use two nested loops to fix the first two elements and a two-pointer sweep on the remainder to find pairs completing the target sum, givin…
How Do You Find a Subarray With a Given Sum?
For arrays of non-negative integers, a sliding window expands and shrinks two pointers over the array to find a contiguous subarray summing to a target in O(n)…
What is the Majority Element Problem?
The majority element problem asks you to find the element that appears more than n/2 times in an array of size n, and it is solved optimally in O(n) time and O…
How Does the Boyer-Moore Voting Algorithm Work?
The Boyer-Moore voting algorithm finds a majority element (one appearing more than n/2 times) in a single O(n)-time, O(1)-space pass by treating each element a…