zomato logo
Zomato· Fresh Graduate

Eternal (Zomato) | Fresh Graduate OA 2026 | On-Campus Recruitment

Posted
7 Aug 2025
679 reads

Summary

I experienced an Online Assessment for a Fresh Graduate role at Zomato (Eternal program), which consisted of 3 DSA problems and 18 MCQs on CS fundamentals and ML. I have provided the details of the DSA problems encountered.

How it went

OA Pattern : 3 DSA 65 minutes, 18 MCQs 20 minutes MCQs were based on CS fundaments and ML


Problem 1: Minimum Swaps to Sort Non-Zeros (100 points)

You are given an array of integers, where some elements are zeros and others are non-zero integers. Your task is to find the minimum number of swaps required to sort the non-zero elements in ascending order, while keeping all zeros at the end of the array.

Rules:

  • You can only swap a non-zero element with a zero.

Problem 2: Minimize Longest Continuous Sequence After Flipping (60 points)

You are given a string consisting only of the characters 'a' and 'b'. You can flip characters, meaning you can swap 'a' to 'b' and vice versa, at most k times.

Your task is to minimize the length of the longest continuous sequence of the same character (either 'a' or 'b') in the string, after performing at most k flips.

Problem 3: Max Score of Substrings (50 points)

You are given a string s and a number k. You need to calculate the maximum score of any substring of length k in the string. The score of a substring is calculated as follows:

For each character in the substring:

  • Its "character value" raised to the power of its frequency in the substring.

The character values are as follows:

  • 'a' = 1, 'b' = 2, ..., 'z' = 26.

Return the maximum score among all substrings of length k. Since the result can be large, return it modulo $10^9 + 7$.

Example 1:

Input: s = "abaab", k = 2
Output: 3
Explanation: The substrings of length 2 are: 
  "ab" → score = 1^1 + 2^1 = 3
  "ba" → score = 2^1 + 1^1 = 3
  "aa" → score = 1^2 = 1
  "ab" → score = 1^1 + 2^1 = 3
The maximum score is 3.

Questions asked (3)

  1. 01

    Minimum Swaps to Sort Non-Zeros

    Data Structures & Algorithms

    You are given an array of integers, where some elements are zeros and others are non-zero integers. Your task is to find the minimum number of swaps required to sort the non-zero elements in ascending order, while keeping all zeros at the end of the array.

    Rules:

    • You can only swap a non-zero element with a zero.
  2. 02

    Minimize Longest Continuous Sequence After Flipping

    Data Structures & Algorithms

    You are given a string consisting only of the characters 'a' and 'b'. You can flip characters, meaning you can swap 'a' to 'b' and vice versa, at most k times.

    Your task is to minimize the length of the longest continuous sequence of the same character (either 'a' or 'b') in the string, after performing at most k flips.

  3. 03

    Max Score of Substrings

    Data Structures & Algorithms

    You are given a string s and a number k. You need to calculate the maximum score of any substring of length k in the string. The score of a substring is calculated as follows:

    For each character in the substring:

    • Its "character value" raised to the power of its frequency in the substring.

    The character values are as follows:

    • 'a' = 1, 'b' = 2, ..., 'z' = 26.

    Return the maximum score among all substrings of length k. Since the result can be large, return it modulo $10^9 + 7$.

    Example 1:

    Input: s = "abaab", k = 2
    Output: 3
    Explanation: The substrings of length 2 are: 
      "ab" → score = 1^1 + 2^1 = 3
      "ba" → score = 2^1 + 1^1 = 3
      "aa" → score = 1^2 = 1
      "ab" → score = 1^1 + 2^1 = 3
    The maximum score is 3.
    

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Zomato recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!