Skip to content

Zomato Coding Questions with Solutions 2025 - DSA Problems, System Design & Behavioral Questions

Practice Zomato coding questions with detailed solutions. Previous year DSA problems, system design questions, and behavioral questions from Zomato placement papers with step-by-step explanations.

This comprehensive collection contains Zomato coding questions from previous year placement papers with detailed solutions. Practice these problems to master Zomato’s coding section covering DSA, system design, and behavioral questions.

ParameterDetails
Total Problems2-3 DSA problems
Time Allocated90-120 minutes
DifficultyMedium to Hard
Languages AllowedJava, C++, Python, Go
PlatformHackerRank or Zomato’s internal tool
AdditionalDebugging questions

Q1: Maximum Sum Subarray (Kadane’s Algorithm)

Given an array of integers, find the maximum sum subarray.

Problem: Find the contiguous subarray with the largest sum.

Example: Input: [-2, 1, -3, 4, -1, 2, 1, -5, 4], Output: 6 (subarray [4, -1, 2, 1])

Solution:

def max_subarray_sum(arr):
max_sum = float('-inf')
current_sum = 0
for num in arr:
current_sum += num
if current_sum > max_sum:
max_sum = current_sum
if current_sum < 0:
current_sum = 0
return max_sum

Explanation: Use Kadane’s algorithm - maintain current sum and reset to 0 if negative. Time: O(n), Space: O(1)

Answer: 6

Q2: Shortest Path in Graph (Dijkstra’s Algorithm)

Find shortest path between two nodes in a weighted graph using Dijkstra’s algorithm.

Problem: Find shortest path from source to destination in a weighted graph.

Example: Graph with nodes A, B, C, D and edges (A→B: 1), (A→C: 4), (B→C: 2), (C→D: 1), (B→D: 5). Shortest path from A to D: A→B→C→D (cost: 4)

Solution:

#include <vector>
#include <queue>
#include <climits>
int dijkstra(vector<vector<pair<int, int>>>& graph, int src, int dest) {
int n = graph.size();
vector<int> dist(n, INT_MAX);
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
dist[src] = 0;
pq.push({0, src});
while (!pq.empty()) {
int u = pq.top().second;
int d = pq.top().first;
pq.pop();
if (u == dest) return d;
if (d > dist[u]) continue;
for (auto& edge : graph[u]) {
int v = edge.first;
int w = edge.second;
if (dist[u] + w < dist[v]) {
dist[v] = dist[u] + w;
pq.push({dist[v], v});
}
}
}
return dist[dest];
}

Explanation: Use priority queue to always process node with minimum distance. Time: O((V+E)logV), Space: O(V)

Answer: 4

Q3: Coin Change Problem

Given coins and amount, find minimum coins needed using dynamic programming.

Problem: Find minimum number of coins to make given amount.

Example: coins = [1, 2, 5], amount = 11. Output: 3 (5 + 5 + 1)

Solution:

int coinChange(vector<int>& coins, int amount) {
vector<int> dp(amount + 1, amount + 1);
dp[0] = 0;
for (int i = 1; i <= amount; i++) {
for (int coin : coins) {
if (coin <= i) {
dp[i] = min(dp[i], dp[i - coin] + 1);
}
}
}
return dp[amount] > amount ? -1 : dp[amount];
}

Explanation: DP approach - for each amount, try all coins and take minimum. Time: O(amount × coins), Space: O(amount)

Answer: 3

Q4: Binary Tree Level Order Traversal

Given a binary tree, return level order traversal.

Problem: Traverse binary tree level by level.

Example: Tree [3,9,20,null,null,15,7] → [[3], [9,20], [15,7]]

Solution:

def levelOrder(root):
if not root:
return []
result = []
queue = [root]
while queue:
level = []
size = len(queue)
for _ in range(size):
node = queue.pop(0)
level.append(node.val)
if node.left:
queue.append(node.left)
if node.right:
queue.append(node.right)
result.append(level)
return result

Explanation: Use BFS with queue, process each level. Time: O(n), Space: O(n)

Answer: [[3], [9,20], [15,7]]

Q5: Two Sum Problem

Find two numbers that add up to target.

Problem: Given array and target, find indices of two numbers that sum to target.

Example: nums = [2,7,11,15], target = 9 → [0,1]

Solution:

def twoSum(nums, target):
hash_map = {}
for i, num in enumerate(nums):
complement = target - num
if complement in hash_map:
return [hash_map[complement], i]
hash_map[num] = i
return []

Explanation: Use hash map to store seen numbers. Time: O(n), Space: O(n)

Answer: [0, 1]

Q6: Longest Palindromic Substring

Find longest palindromic substring in a string.

Problem: Find longest palindrome substring.

Example: “babad” → “bab” or “aba”

Solution:

def longestPalindrome(s):
def expand(l, r):
while l >= 0 and r < len(s) and s[l] == s[r]:
l -= 1
r += 1
return s[l+1:r]
result = ""
for i in range(len(s)):
odd = expand(i, i)
even = expand(i, i+1)
result = max(result, odd, even, key=len)
return result

Explanation: Expand around center for odd/even length palindromes. Time: O(n²), Space: O(1)

Answer: “bab” or “aba”

Q7: Merge Intervals

Merge overlapping intervals.

Problem: Merge all overlapping intervals.

Example: [[1,3],[2,6],[8,10],[15,18]] → [[1,6],[8,10],[15,18]]

Solution:

def merge(intervals):
intervals.sort(key=lambda x: x[0])
merged = []
for interval in intervals:
if not merged or merged[-1][1] < interval[0]:
merged.append(interval)
else:
merged[-1][1] = max(merged[-1][1], interval[1])
return merged

Explanation: Sort by start, merge if overlapping. Time: O(n log n), Space: O(n)

Answer: [[1,6],[8,10],[15,18]]

Q8: Valid Parentheses

Check if parentheses string is valid.

Problem: Check if string has valid parentheses matching.

Example: ”()[]” → true, ”([)]” → false

Solution:

def isValid(s):
stack = []
mapping = {')': '(', '}': '{', ']': '['}
for char in s:
if char in mapping:
if not stack or stack.pop() != mapping[char]:
return False
else:
stack.append(char)
return not stack

Explanation: Use stack to match opening/closing brackets. Time: O(n), Space: O(n)

Answer: true for ”()[]”, false for ”([)]”

Practice More Zomato Interview Questions →

Zomato Placement Papers 2024

Practice Zomato placement papers 2024 with coding questions, DSA problems, and complete solutions.


Practice 2024 Papers →

Zomato Placement Papers 2025

Access latest Zomato placement papers 2025 with current year coding questions and updated patterns.


Practice 2025 Papers →

Complete Zomato Guide

Return to complete Zomato placement papers guide with eligibility, process, and all question types.


View Complete Guide →


Ready to practice Zomato coding questions? Focus on DSA fundamentals, system design, and Zomato values. Practice with Zomato placement papers and solve problems in Java, C++, Python, or Go.

Pro Tip: Practice medium to hard difficulty problems on LeetCode and HackerRank. Focus on optimal solutions and clear explanations. Use Zomato placement papers for realistic practice. Watch YouTube tutorials (Striver, Take U Forward) for detailed explanations of complex problems.