Ola Coding Interview Questions
100 Ola coding interview problems with full optimal solutions — 32 easy, 60 medium, 8 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Ola interviewer values, and a FAQ section.
Showing 32 problems of 100
- #1easyfoundational
1. Two Sum
Find two indices in an array whose values sum to a target.
- #2easyfoundational
2. Valid Parentheses
Validate that bracket characters in a string close in the right order.
- #3easyfoundational
3. Merge Two Sorted Lists
Merge two ascending linked lists into one sorted list.
- #4easyfoundational
4. Remove Duplicates from Sorted Array
Remove duplicates in-place from a sorted array and return the new length.
- #5easyfoundational
5. Remove Element
Remove all occurrences of a value from an array in-place and return the new length.
- #6easyfoundational
6. Search Insert Position
Find the index where a target should be inserted in a sorted array.
- #7easyfoundational
7. Plus One
Add one to an integer represented as an array of digits.
- #8easyfoundational
8. Merge Sorted Array
Merge two sorted arrays in-place into the first.
- #9easyfoundational
9. Binary Tree Inorder Traversal
Return the inorder traversal of a binary tree's node values.
- #10easyfoundational
10. Same Tree
Determine whether two binary trees are structurally identical with equal values.
- #11easyfoundational
11. Symmetric Tree
Check whether a binary tree mirrors itself around the center.
- #12easyfoundational
12. Maximum Depth of Binary Tree
Find the maximum depth (height) of a binary tree.
- #13easyfoundational
13. Balanced Binary Tree
Determine whether a binary tree is height-balanced.
- #14easyfoundational
14. Minimum Depth of Binary Tree
Find the shortest path from the root to any leaf in a binary tree.
- #15easyfoundational
15. Pascal's Triangle
Generate the first numRows of Pascal's triangle.
- #16easyfoundational
16. Best Time to Buy and Sell Stock
Maximize profit from a single buy/sell of a daily price array.
- #17easyfoundational
17. Valid Palindrome
Determine if a phrase reads the same forward and backward, ignoring non-alphanumerics.
- #18easyfoundational
18. Single Number
Find the lone element in an array where every other element appears twice.
- #19easyfoundational
19. Linked List Cycle
Detect whether a linked list contains a cycle.
- #20easyfoundational
20. Min Stack
Design a stack that supports retrieving the minimum element in O(1).
- #21easyfoundational
21. Two Sum II - Input Array Is Sorted
Find two indices in a sorted array whose values sum to a target using O(1) extra space.
- #22easyfoundational
22. Majority Element
Find the element that appears more than n/2 times in an array.
- #23easyfoundational
23. Rotate Array
Rotate an array to the right by k steps in-place.
- #24easyfoundational
24. Reverse Bits
Reverse the bits of a 32-bit unsigned integer.
- #25easyfoundational
25. Number of 1 Bits
Count the set bits (Hamming weight) of an unsigned integer.
- #27easyfoundational
27. Happy Number
Determine whether iteratively replacing a number with the sum of squares of its digits eventually reaches 1.
- #28easyfoundational
28. Isomorphic Strings
Decide whether two strings have a one-to-one character mapping.
- #29easyfoundational
29. Reverse Linked List
Reverse a singly linked list and return the new head.
- #30easyfoundational
30. Contains Duplicate
Return true if any value appears at least twice in an array.
- #80easyfoundational
80. Path Sum
Decide if any root-to-leaf path of a binary tree sums to a target.
- #91easyfoundational
91. Invert Binary Tree
Mirror a binary tree by swapping left and right at every node.
- #94easyfoundational
94. Valid Anagram
Determine whether two strings are anagrams of each other.