This is a repository of solutions to all problems I’ve solved on InterviewBit. I am not quite sure exactly how many problems there are on the website, but I’ll be updating this with every problem I solve. Please issue a pull request if you think you have a better solution or something I could improve upon.
SubTopic | Title | Solution | Notes |
Array math | Min Steps in Infinite Grid | C++ | Simpler Than I originally thought. |
Array math | Max Sum Contiguous Subarray | C++ | |
Array math | Add One To Number | ||
Array math | Repeat and Missing Number Array | ||
Array math | Flip | ||
Simulation array | Max Non Negative SubArray | C++ Python | |
Simulation array | Kth Row of Pascal’s Triangle | ||
Simulation array | Pascal Triangle Rows | Python | |
Simulation array | Spiral Order Matrix II | C++ Python | |
Simulation array | Anti Diagonals | C++ | |
Arrangement | Rotate Matrix | C++ | |
Arrangement | Largest Number | C++ | |
Arrangement | Next Permutation | ||
Bucketing or sorting | Hotel Bookings Possible | ||
Bucketing or sorting | Wave Array | C++ | |
Bucketing or sorting | Largest Number | C++ | |
Bucketing or sorting | Max Distance | ||
Bucketing or sorting | Maximum Consecutive Gap | ||
Bucketing or sorting | Find Duplicate in Array | C++ | |
Value ranges | Merge Intervals | C++ | |
Value ranges | Merge Overlapping Intervals | ||
Space recycle | Set Matrix Zeros | C++ | |
Space recycle | First Missing Integer | ||
Missing / repeated number | First Missing Integer | ||
Missing / repeated number | Repeat and Missing Number Array | ||
Missing / repeated number | Find Duplicate in Array | ||
Missing / repeated number | N/3 Repeat Number |
SubTopic | Title | Solution | Notes |
Adhoc | Prime Sum | Python C++ | |
Adhoc | Power of Two Integers | C++ Python | |
Base conversion | Excel Column Number | C++ Python | |
Base conversion | Excel Column Title | C++ Python | |
Digit op | Palindrome Integer | C++ Python | |
Digit op | Reverse Integer | C++ Python | |
Number theory | Greatest Common Divisor | C++ Python | |
Number theory | Trailing Zeros in Factorial | C++ Python | |
Number theory | Sorted Permutation Rank | ||
Number theory | Sorted Permutation Rank with Repeats | ||
Number encoding | Rearrange Array | C++ Python | |
Combinatorics | Grid Unique Paths | C++ Python | Note the difference in length between the Python and C++ solutions |
SubTopic | Title | Solution | Notes |
Simple binary search | Matrix Search | ||
Simple binary search | Search for a Range | ||
Simple binary search | Sorted Insert Position | ||
Search answer | Square Root of Integer | ||
Search answer | Painter’s Partition Problem | ||
Search answer | Allocate Books | ||
Search step simulation | Implement Power Function | ||
Sort modification | Rotated Sorted Array Search | ||
Sort modification | Median of Array |
SubTopic | Title | Solution | Notes |
Multiple Stack | Min Stack | C++ | IB has an annoying redefinition issue in their buffer. |
Stack math | Evaluate Expression | C++ | |
Stack Simple | Redundant Braces | C++ | |
CleverStack | Nearest Smaller Element | C++ | Forgot to use a solution vector the first time around. |
Subtopic | Title | Solution | Notes |
Examples | Intersection of Linked List | C++ | |
List 2 Pointer | Palindrome List | C++ | |
List 2 Pointer | Merge Sorted List | C++ | |
List 2 Pointer | Remove Duplicates from sorted list i | C++ | |
List 2 Pointer | Remove Duplicates from sorted list ii | C++ | |
List 2 Pointer | Remove nth node from list end | C++ | |
List 2 Pointer | Rotate List | C++ | |
List 2 Pointer | Reverse Linked List II | C++ | |
List 2 Pointer | Reorder List | C++ Python | |
List Math | Add Two Numbers as Lists | C++ Python | |
List Math | List Cycle | C++ Python | Python Solution is much simpler |
List Sort | Partiton List | C++ Python |