35+ Competitive Coding Questions with Solutions | asked in Interviews 2021

Here is the list of competitive coding questions answers. These latest coding challenges are asked in the product-based companies in recent times (2020-2021).

Almost all the product-based and high-paying companies (like Google, Facebook, Flipkart, Walmart, Amazon, Netflix, Oracle, etc.) conduct competitive coding round on various platforms like HackerRank, HackerEarth. Hope you find this list useful for your practice and excelling job interviews.

I have personally solved each of the questions and explained them with the answers. I would recommend you to go through the question, try to solve it by yourself, and then check the solution.

You can use our online IDE to practice and run your code.

You can solve these competitive coding questions in any programming language of your choice like C, C++, Java, Python, etc.

These questions are sorted by the difficulty level. So take the first question, solve it and then move to the next one. If you are beginner, start from the first question.

Any query or difficulty? Write it in the comment.

Let’s begin…

Competitive Coding Questions with Solutions asked in Interview

  1. Count Common Factor [HackerEarth contest]
  2. Does it Divide [HackerEarth contest]
  3. Sum of Sub Arrays [HackerEarth contest]
  4. Pair of Desired Sum [Adobe, Amazon]
  5. Remove Duplicate Char from String
  6. Sort String by Char Freq (Python)
  7. Sort String by Char Freq (Java)
  8. Split Array into Equal Sum Subarray [Morgan Stanley]
  9. Validate IP Address [Juniper]
  10. Validate PAN Card Number [Bright Money]
  11. Validate Sudoku [Protonn]
  12. Sort Circular Rotated Array [Byju’s]
  13. Minimum Arrow to Burst Bubbles [Petasense]
  14. Minimum Cost to Paint All Houses [Amazon]
  15. HourGlass with Largest Sum [HackerRank Test]
  16. Maximum Profit by Buying/Selling Stocks [Goldman Sachs]
  17. Hailstone Sequence [NVIDIA]
  18. Reverse String without affecting Special Characters [Oracle]
  19. Secure Conversation by Encryption/Decryption [Goldman Sachs]
  20. Special Elements in Matrix [Syntel Hackathon]
  21. Next Greater Number with Same Set of Digits [Microsoft]
  22. Smallest Subarray with Sum Greater than Given Number [Goldman Sachs]
  23. Group Anagrams [Goldman Sachs]
  24. Find Duplicates in Array in O(n) [NVIDIA]
  25. Find Two Unique Numbers from Array in O(n) [NVIDIA]
  26. Number Patterns & Finding Smallest Number [Goldman Sachs, Google]
  27. Minimum Cost of Merging Files [Amazon]
  28. Minimum Distance for Truck to Deliver Order [Amazon]
  29. Multilevel Parking System Design [Treebo Hotels]
  30. Minimum Coins Required [Byju’s]
  31. Maximum Sum Subarray [Microsoft]
  32. Maximum Average Sum of Two Subsequences
  33. Merge Overlapping Intervals [Byju’s]
  34. Longest Balanced Subarray [Bright Money]
  35. Longest Path in a Weighted Tree
  36. Generate Balanced Parentheses [OVH cloud]
  37. PostOrder Traversal Without Recursion [OVH cloud]

Leave a Reply