Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Disney + Hotstar interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Disney + Hotstar
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: OOPS, System Design, Algorithms, Data Structures,DBMS
Tip
Tip

Tip 1 : Prepare System Design
Tip 2 : Practice DSA Questions properly
Tip 3 : Practice OOPS and DBMS Concepts

Application process
Where: Referral
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1 : Your Resume should consist mainly of skills, projects, and achievements. Projects would play a crucial part in your interview and you should have at least one most relevant and good project that shows how strong your concepts are in development.
Tip 2 : The most important tip is that never lie on your resume If you have worked upon some technology for the project part only and don't know the proper depth you could write basics only in your resume.

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date25 Aug 2022
Coding problem2

The Round was conducted on Zoom. It was a Coding Round that only consisted of 2 DSA questions. This Round was taken by an SDE-2 Engineer at Hotstar.

1. Keys and Rooms

Moderate
30m average time
70% success
0/80
Asked in companies
ZomatoAdobeDisney + Hotstar

You are given some information about the rooms of a military camp. The rooms are numbered from 0 to 'N-1'. Each room contains keys to some other rooms. You can visit a room only if you have a key to that room. Your task is to determine whether each room can be visited or not.

Note:

1. Room 0 is the only room that is initially unlocked and doesn’t require any key to enter.

2. Any other room can be visited only if you have the key to that room.

3. More than one room can have keys to the same room.

4. You are allowed to visit rooms in any order.

5. You can visit any room multiple times.
Problem approach

Since we can only enter rooms to which we have found a key, we can't just iterate through the entire input array (R) normally. If we think of this like a graph problem, we can see that the rooms are like nodes and the keys are like edges.

In that case, we can use a breadth-first search (BFS) queue or a depth-first search (DFS) stack approach, or even a DFS recursion approach here to good effect. Here, we'll push newly found keys onto stack as we go through.

To eliminate duplicate stack entries, we can use a lightweight boolean array (vis) to keep track of which rooms have already been pushed onto the stack. Rather than having to count the number of visited rooms again at the end, we can just use another variable (count) to keep track of that separately.

Once our stack runs empty, we can just check to see if the count is the same as the length of R and return the answer.

Try solving now

2. Minimum Parentheses

Easy
10m average time
90% success
0/40
Asked in companies
GoogleHSBCDisney + Hotstar

Given a string "pattern", which contains only two types of characters ‘(’, ‘)’.

Your task is to find the minimum number of parentheses either ‘(’, ‘)’ we must add the parentheses in string ‘pattern’ and the resulted string is valid.

Condition for valid string-

Every opening parenthesis ‘(’ must have a correct closing parenthesis ‘)’.

Example - ‘(()(()))’, ‘()()()’, ‘((()))’ are valid string, and ‘(((’, ‘(()’, ‘)(())’ are invalid string.

Note:
1. You are not required to print the output explicitly, it has already been taken care of. Just implement the function and return the minimum number of parentheses required to make a string valid.
Problem approach

We keep the track of balance of the string i:e the number of ‘(‘ minus the number of ‘)’. A string is valid if its balance is 0, and also every prefix has non-negative balance.
Now, consider the balance of every prefix of S. If it is ever negative (say, -1), we must add a ‘(‘ bracket at the beginning. Also, if the balance of S is positive (say, +P), we must add P times ‘)’ brackets at the end.

Try solving now
02
Round
Easy
Video Call
Duration60 Minutes
Interview date25 Aug 2022
Coding problem2

This Round was also conducted on the Same Day and the platform was zoom. This round was also a coding round which consisted of 2 DSA problems.

1. 3Sum

Moderate
15m average time
85% success
0/80
Asked in companies
BarclaysMeeshoFreshworks

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a triplet {ARR[i], ARR[j], ARR[k]} with sum = 'K' if there exists three indices i, j and k such that i!=j, j!=k and i!=j and ARR[i] + ARR[j] + ARR[k] = 'K'.

Note:
1. You can return the list of values in any order. For example, if a valid triplet is {1, 2, -3}, then {2, -3, 1}, {-3, 2, 1} etc is also valid triplet. Also, the ordering of different triplets can be random i.e if there are more than one valid triplets, you can return them in any order.
2. The elements in the array need not be distinct.
3. If no such triplet is present in the array, then return an empty list, and the output printed for such a test case will be "-1".
Problem approach

The idea is to sort an input array and then run through all indices of a possible first element of a triplet. For each possible first element we make a standard bi-directional 2Sum sweep of the remaining part of the array. Also we want to skip equal elements to avoid duplicates in the answer without making a set or smth like that.

Try solving now

2. LRU Cache Implementation

Moderate
25m average time
65% success
0/80
Asked in companies
ZomatoQualcommOracle

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.

2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
You will be given ‘Q’ queries. Each query will belong to one of these two types:
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
Note :
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).

2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
Problem approach

The problem can be solved with a hashtable that keeps track of the keys and its values in the double linked list. One interesting property about double linked list is that the node can remove itself without other reference. In addition, it takes constant time to add and remove nodes from the head or tail.

One particularity about the double-linked list that I implemented is that I create a pseudo head and tail to mark the boundary so that we don't need to check the NULL node during the update. This makes the code more concise and clean, and also it is good for the performance.

Try solving now
03
Round
Easy
Video Call
Duration60 Minutes
Interview date26 Aug 2022
Coding problem1

This round was a Hiring Manager round which was taken by a director of engineering at Hotstar conducted over zoom. This round was supposed to be a discussion round about my past internships and my work in them. After the discussion, I was given 1 Dsa problem to solve.

1. Insertion Sort in Linked List

Easy
10m average time
90% success
0/40
Asked in companies
GooglePaytm (One97 Communications Limited)Disney + Hotstar

You are given an arbitrary linked list consisting of 'N' nodes having integer values. You need to perform insertion sort on the linked list and print the final list in sorted order.

In other words, you are given a singly linked list, you need to perform insertion sort on it.

Insertion Sort is a sorting algorithm that removes one element from the input data, finds the location it belongs within the sorted list and inserts it there. It repeats until no input elements remain.
Problem approach

1) If Linked list is empty then make the node as
head and return it.
2) If the value of the node to be inserted is smaller 
than the value of the head node, then insert the node 
at the start and make it head.
3) In a loop, find the appropriate node after 
which the input node (let 9) is to be inserted. 
To find the appropriate node start from the head, 
keep moving until you reach a node GN (10 in
the below diagram) who's value is greater than 
the input node. The node just before GN is the
appropriate node (7).
4) Insert the node (9) after the appropriate node
(7) found in step 3.

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which type of comments is used to comment on single lines of Java code?

Choose another skill to practice
Join the Discussion
2 replies
Anurag Mishra 25 Sep, 2022

Hey, Did you receive any rejection email?

0 replies
0 upvotes
Reply
Report
Mahvish Anwar 6 Sep, 2022

This Comment was removed by the moderator

This comment won't show up to you, as it was removed by moderator due to inappropriate content.

Similar interview experiences
SDE - 1
2 rounds | 4 problems
Interviewed by Disney + Hotstar
540 views
0 comments
0 upvotes
SDE - 1
3 rounds | 5 problems
Interviewed by Disney + Hotstar
613 views
0 comments
0 upvotes
SDE - 1
3 rounds | 5 problems
Interviewed by Disney + Hotstar
393 views
0 comments
0 upvotes
SDE - 1
3 rounds | 6 problems
Interviewed by Disney + Hotstar
468 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
105378 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
50271 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
31306 views
6 comments
0 upvotes