Awesome Open Source
Awesome Open Source


This repository is a collection of my gists (working βœ… code snippets passing all test cases on the InterviewBit online judge) solutions in the absolutely fantastic language, C++.

Edit: I've lately moved to Java hence trying to re-solve all the problems slowly and adding my Java solutions to this repo as well!

Hence, the solutions won't directly execute on your local IDE or compiler, the main() would need to be written and the solution's function would need to be invoked with appropriate inputs/test cases to run in standalone.


  • Sometimes, multiple solutions/approaches have been provided with relevant comments in the solution file, these are being continuously updated as and when I find a more optimized solution. Be wary of copying two solutions separated by comments simultaneously to run/submit on InterviewBit's online judge. Both shall work individually.
  • I've used C++11 (list initialization, auto, emplace_back, etc) features in each and every solution.
  • The solutions also succinctly encompasses years of C++ industry programming experience and care has been taken to optimize even at the slightest visible portions of the code.
  • The code in this repo is completely original content and written by me. If you like what you see, don't forget to show your liking by ⭐️ing this repo.

How to contribute?

  1. Fork the repository 🍴
  2. Do the desired changes (add/delete/modify) ✏️
  3. Make sure you've followed the existing coding standards and pattern of pasting the entire problem statement with a link to the problem on InterviewBit. For reference, you can follow any existing file in this Repo. e.g. AddOneToNumber.cpp
  4. Attach a screenshot from InterviewBit showing that your solution was ACCEPTED by the online judge. I've been getting a lot of pull requests which are not Accepted by the online judge.
  5. Make a pull request

When should you contribute?

  • If your solution's time complexity ⏰ is better than the solution already present or,
  • If your solution's space complexity πŸ’Ύ is better than the solution already present or,
  • If your solution is of the same time and space complexity but is more concise πŸ“ƒ. In this case, comment out the original solution & make a pull request with your solution or,
  • If your solution is of the same time and space complexity but is easier/more readable πŸ“„ to understand or,
  • If you use the same solution as present in the main branch and have gone the extra mile to add short comments πŸ“ explaining what's happening or what's the rationale at that particular code line, wherever necessary. πŸ™

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
c-plus-plus (16,974)Β 
math (193)Β 
maps (162)Β 
queue (161)Β 
stack (100)Β 
hashing (51)Β 
string-manipulation (39)Β 
dynamic-programming (38)Β 
arrays (24)Β 
linked-list (22)Β 
cplusplus-11 (18)Β 
trees (15)Β 
bit-manipulation (14)Β 
cplusplus-14 (14)Β 

Find Open Source By Browsing 7,000 Topics Across 59 Categories