Happay interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Happay
upvote
share-icon
3 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Journey
"I have started solving questions on coding platforms and applied for this job on LinkedIn. I solved easy questions first and then started solving medium and hard-level questions. I have good knowledge of OS and system design, so I focus on DSA. The HR contacted me and sent me the test link. After the test, I was selected after one test and two interviews."
Application story
I have applied for the Job posted by the company on LinkedIn. HR contacted me after a week or two and sent me the test link.
Why selected/rejected for the role?
Yes, I have been selected for this role. After completing the interview process, HR contacted me for my expectations and provided me with an offer letter after a week.
Preparation
Duration: 2
Topics: Data Structure and Algorithms - Graph, LinkedList, Array, String, Tree and System Design
Tip
Tip

Tip 1 : Use coding platforms for DSA
Tip 2 : System Design - An Insider Guide - Good book for system design
Tip 3 : Two scoops of Django

Application process
Where: Linkedin
Resume Tip
Resume tip

Tip 1 : Resume should be of one column.
Tip 2 : Your main skills should be highlighted

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 minutes
Interview date6 Oct 2022
Coding problem2

It was an online test.

1. Modify Linked list

Easy
10m average time
90% success
0/40
Asked in companies
FacebookIBMDream11

You are given a linked list containing N nodes where each node is associated with a certain value. Return a linked list as follows: If the input linked list is 1-->2-->3-->4, then the output should be 1-->4-->2-->3. And if the input is 1-->2-->3-->4-->5, then the output should be 1-->5-->2-->4-->3.

In other words, if the original linked list is first -> second -> third -> ……….->thirdlast -> secondlast -> last, then the modified linked list would be first -> last -> second -> second_last -> ...

Note

1. All the node values are positive.

2. The size of the linked list is greater than 1.

3. The end of the linked list is represented by -1.
Try solving now

2. Best Time to Buy and Sell Stock

Moderate
20m average time
80% success
0/80
Asked in companies
OYOInfosysAmazon

You are given an array/list 'prices' where the elements of the array represent the prices of the stock as they were yesterday and indices of the array represent minutes. Your task is to find and return the maximum profit you can make by buying and selling the stock. You can buy and sell the stock only once.

Note:

You can’t sell without buying first.
For Example:
For the given array [ 2, 100, 150, 120],
The maximum profit can be achieved by buying the stock at minute 0 when its price is Rs. 2 and selling it at minute 2 when its price is Rs. 150.
So, the output will be 148.
Problem approach

I solved it using Dynamic Programming.
I employed a straightforward approach that iterates through the array of stock prices. At each step, I kept track of the minimum stock price seen so far (min_price) and calculated the potential profit that could be obtained by selling at the current price (prices[i] - min_price). I updated the maxprof (maximum profit) variable with the maximum of its current value and the calculated profit. Additionally, I updated the min_price to be the minimum of the current stock price and the previously seen minimum.

Try solving now
02
Round
Easy
Face to Face
Duration60 minutes
Interview date17 Oct 2023
Coding problem3

This was a 60 minute round with senior developer

1. Kth Smallest Element

Easy
15m average time
85% success
0/40
Asked in companies
SnapdealMicrosoftMedia.net

You are given an array of integers 'ARR' of size 'N' and another integer 'K'.


Your task is to find and return 'K'th smallest value present in the array.


Note: All the elements in the array are distinct.


Example
If 'N' is 5 and 'K' is 3 and the array is 7, 2, 6, 1, 9

Sorting the array we get 1, 2, 6, 7, 9

Hence the 3rd smallest number is 6.
Problem approach

A min-heap to maintain the k-th most significant elements. The heap allows us to efficiently compare each new element with the smallest k-th most prominent elements. By the end of the iteration, the top of the heap will contain our desired kth most significant element.

Try solving now

2. Search In Rotated Sorted Array

Moderate
30m average time
65% success
0/80
Asked in companies
MicrosoftOptumZS Associates

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4, 5] and if he rotates it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, Aahad needs to answer Q queries asked by Harshit, each of them is described by one integer Q[i]. which Harshit wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where 'key' denotes Q[i]. If the key exists in the array, return the index of the 'key', otherwise, return -1.

Note:

Can you solve each query in O(logN) ?
Problem approach

Binary search is an efficient algorithm for finding a target value within a sorted list. It works by repeatedly dividing the search interval in half. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise, narrow it to the upper half. Repeatedly check until the value is found or the interval is empty.

Try solving now

3. Django Question

Difference b/w select_related and prefetch_related? (Learn)

Problem approach

Tip 1: Read about Django Optimisation
Tip 2: Read about Django ORM

03
Round
Easy
Video Call
Duration90 minutes
Interview date24 Oct 2023
Coding problem3

This round was with the team lead.

1. Possible Bipartition

Moderate
20m average time
80% success
0/80
Asked in companies
AmazonAppleSprinklr

You are given an integer ‘N’ which denotes a set of N people numbered from 1 to N and a matrix ‘DISLIKE’ with M rows and 2 columns. Each row in the matrix denotes two people who dislike each other i.e. for any valid row i, DISLIKE[i][0] dislikes DISLIKE[i][1] and vice versa.

Your task is to split the set of N people into two groups under the conditions:

1. It is not allowed to put two persons in the same group who dislike each other.

2. The size of the two groups may or may not be equal.

3. Each person from the set belongs to exactly one group.

Problem approach

Here we need to deal with the adjacent nodes, a bfs will be very easy approach towards this problem. 
For each connected component we will give it a color and try bfs and check for the constraints recursively

Try solving now

2. Coin Change(Finite Supply)

Hard
0/120
Asked in companies
AmazonAdobeMicrosoft

You are given an array of integers ‘coins’ denoting the denomination of coins and another array of integers ‘freq’ denoting the number of coins of each denomination.

You have to find the number of ways to make the sum ‘V’ by selecting some(or all) coins from the array.

The answer can be very large. So, return the answer modulo 1000000007.

For Example :
‘N’ = 3, ‘coins’ = {1, 2, 3}, ‘freq’ = {1, 1, 3}, ‘V’ = 6

For the given example, we can make six by using the following coins:
{1, 2, 3}
{3. 3}
Hence, the answer is 2.
Problem approach

def change(self, amount: int, coins: List[int]) -> int:
dp = [0] * (amount + 1) 
dp[0] = 1 

for coin in coins: 
for j in range(coin, amount + 1): 
dp[j] += dp[j - coin] 

return dp[amount]

We kick off by initializing our dp with zeroes, setting dp[0] to 1 (because there's just one way to make zero: by not using any coins).
As we iterate over each coin, we update our dp slice. For every potential amount from the coin's value up to our target, we incrementally update the number of ways in the dp slice.

Try solving now

3. System Design

Design Instagram (Practice)

Problem approach

Tip 1: Read about designs and different approaches for optimized design
Tip 2: I suggest some books - System Design, An Insider Guide, and Data Intensive Application

Here's your problem of the day

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

Skill covered: Programming

What is the output of print(type("Python"))?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
5791 views
0 comments
0 upvotes
Analytics Consultant
3 rounds | 10 problems
Interviewed by ZS Associates
594 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
2160 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 6 problems
Interviewed by Expedia Group
1626 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
110853 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
54663 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
33446 views
6 comments
0 upvotes