Eternal Ltd(Zomato) | OA | SDE-1
Anonymous User
4125

Hi everyone, recently i gave the OA of Zomato on the hackerank platform.
There were total of 3 DSA Q's each of 100 score and 13 CS-Fundamentals MCQ'S each of 5 score, and we were given the total time of 90 minutes.
Below are my memory based Q description, if anybody able to find exact Q in any coding platform, please do tag in the comments, thanks in advance.

1. Minimize Tree Height with K Cut & Attach-to-Root Operations

Problem:
You're given a rooted tree. In up to K operations, you can:

  • Cut any subtree from its parent.
  • Attach it directly under the root.

Goal: Minimize the height of the final tree and return it.


2. Tree Node Stones – Make Adjacent Difference Exactly 1

Problem:
You're given a tree with n nodes. Each node already has a number of stones assigned (some may be zero).
You can only add stones (not remove).
Goal: Add the minimum total number of extra stones so that for every edge (u, v):

|stones[u] - stones[v]| == 1

3. Fill Array Zeros with Positive Integers to Satisfy Adjacent |diff| ≤ 1

Problem:
Given an array arr of length n, with some elements as 0,
fill those positions with positive integers from [1, M] such that:

|arr[i] - arr[i+1]| ≤ 1

Count the number of valid full arrays.


I was able to solve 1st and 3rd partially.

Comments (7)