Nykaa | Rejected
Summary
I interviewed with Nykaa and unfortunately, my application was rejected. During the interview, I faced two coding problems, and I provided a solution for one of them.
Full Experience
I recently had an interview experience with Nykaa. Despite my best efforts, my application was ultimately rejected. The interview process included a technical round where I was given two distinct coding challenges. I focused on providing a clear solution for the second problem, 'Keys and Rooms', and presented my approach and code for it. The first problem involved a scenario of allocating computational resources based on specific rating conditions.
Interview Questions (2)
There are n computation requests in a queue to the server. Each request is assigned a rating value given in an integer array ratings.
The server needs to allocate computational resources to the requests subject to the following conditions:
- Each request must get at least one computational resource.
- Requests with higher ratings get more resources than their neighbors.
Return the minimum number of resources the server needs to allocate to the requests.
Input: ratings = [1,0,2]
Output: 5
Explanation: You can allocate to the first, second and third request with 2, 1, 2 resources respectively.
Input: ratings = [1,2,2]
Output: 4
Explanation: You can allocate to the first, second and third request with 1, 2, 1 resources respectively.
The third request gets 1 resource because it satisfies the above two conditions.
There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.
When you visit a room, you may find a set of distinct keys in it. Each key has a number on it, denoting which room it unlocks, and you can take all of them with you to unlock the other rooms.
Given an array rooms where rooms[i] is the set of keys that you can obtain if you visited room i, return true if you can visit all the rooms, or false otherwise.
Example 1:
Input: rooms = [[1],[2],[3],[]]
Output: true