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.
Competitive Coding Questions with Solutions asked in Interview
- Count Common Factor [HackerEarth contest]
- Does it Divide [HackerEarth contest]
- Sum of Sub Arrays [HackerEarth contest]
- Pair of Desired Sum [Adobe, Amazon]
- Remove Duplicate Char from String
- Sort String by Char Freq (Python)
- Sort String by Char Freq (Java)
- Split Array into Equal Sum Subarray [Morgan Stanley]
- Validate IP Address [Juniper]
- Validate PAN Card Number [Bright Money]
- Validate Sudoku [Protonn]
- Sort Circular Rotated Array [Byju’s]
- Minimum Arrow to Burst Bubbles [Petasense]
- Minimum Cost to Paint All Houses [Amazon]
- HourGlass with Largest Sum [HackerRank Test]
- Maximum Profit by Buying/Selling Stocks [Goldman Sachs]
- Hailstone Sequence [NVIDIA]
- Reverse String without affecting Special Characters [Oracle]
- Secure Conversation by Encryption/Decryption [Goldman Sachs]
- Special Elements in Matrix [Syntel Hackathon]
- Next Greater Number with Same Set of Digits [Microsoft]
- Smallest Subarray with Sum Greater than Given Number [Goldman Sachs]
- Group Anagrams [Goldman Sachs]
- Find Duplicates in Array in O(n) [NVIDIA]
- Find Two Unique Numbers from Array in O(n) [NVIDIA]
- Number Patterns & Finding Smallest Number [Goldman Sachs, Google]
- Minimum Cost of Merging Files [Amazon]
- Minimum Distance for Truck to Deliver Order [Amazon]
- Multilevel Parking System Design [Treebo Hotels]
- Minimum Coins Required [Byju’s]
- Maximum Sum Subarray [Microsoft]
- Maximum Average Sum of Two Subsequences
- Merge Overlapping Intervals [Byju’s]
- Longest Balanced Subarray [Bright Money]
- Longest Path in a Weighted Tree
- Generate Balanced Parentheses [OVH cloud]
- PostOrder Traversal Without Recursion [OVH cloud]