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

SDE - 1

ShareChat
upvote
share-icon
2 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Journey
I started my coding journey in Feb 2023. Firstly I solved approx. 50-60 questions on the Hackkerank platform to brush up on my programming syntax and warmup. then I start coding on Leetcode and GFG platforms simultaneously. I picked each data structures topic and start solving questions for the same from easy to medium level. Firstly, I picked LinkedList data structures and coded approx. 40 questions for the same and then I picked Hashing, Stack, Queue, and Trees. Graphs I solved very limited questions (only BFS, DFS, and topological sort-based questions). Dynamic programming I solved approx. again 20-25 questions basically these are the generic ones only like LCS, Knapsack, etc. My approach for solving the question was to spend around 10-15 mins to first try building the solution. If I were not able to build the solution, then I used to refer to some post or YouTube to understand the same. and after that, I keep this question on my to-do list then the next or next-to-next day, I used to code by myself the approach I watched on post/YouTube.
Application story
I got this opportunity through the Online coding platform. I prepare moderate data structures like a linked list, trees, graphs, and arrays.
Why selected/rejected for the role?
Team is expecting 3 problem solving questions in one hour. (2 easy and 1 medium level question) and I was able to solve just 2 of them.
Preparation
Duration: 7 months
Topics: I prepare moderate data structures like a linked lists, trees, graphs, and arrays.
Tip
Tip

Tip 1 : try to complete the medium code in 30 mins of durations.
Tip 2 : Prepare one coding language in which you are more comfortable with.
Tip 3 : Practice daily on CodeStudio.

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

Tip 1 : Have some projects on your resume.
Tip 2 : Never put false things.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration45
Interview date21 Oct 2023
Coding problem4

1. Maximum Path Sum Between Two Leaves

Hard
50m average time
35% success
0/120
Asked in companies
OYOAmazonMathworks

You are given a non-empty binary tree where each node has a non-negative integer value. Return the maximum possible sum of path between any two leaves of the given tree.

The path is also inclusive of the leaf nodes and the maximum path sum may or may not go through the root of the given tree.

If there is only one leaf node in the tree, then return -1.

Problem approach

You are given a non-empty binary tree where every node has positive val. ret the max possible path sum b/w any two leaves of the given tree.
If there is single node in the tree, then return negative one.
The path is also inclusive of the leaf nodes and the max path sum may or may not go through the root of the given tree.

Try solving now

2. Network Delay Time

Easy
20m average time
80% success
0/40
Asked in companies
VisaShareChatDeHaat

You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (ui, vi, wi), where ui is the source node, vi is the target node, and wi is the time it takes for a signal to travel from source to target.We will send a signal from a given node k. Return the minimum time it takes for all the n nodes to receive the signal. If it is impossible for all the n nodes to receive the signal, return -1.

Problem approach

I think bfs and Dijkstra are very similar problems. It's just that Dijkstra cost is different compared with bfs, so use priorityQueue instead a Queue for a standard bfs search.

Try solving now

3. OS Question

2. OS Question
In priority scheduling algorithm ____________
a) CPU is allocated to the process with the highest priority
b) CPU is allocated to the process with the lowest priority
c) Equal priority processes can not be scheduled
d) None of the mentioned

3. OS Question
To avoid deadlock ____________
a) there must be a fixed number of resources to allocate
b) resource allocation must be done only once
c) all deadlocked processes must be aborted
d) inversion technique can be used

4. DBMS

1. DBMS Question
Which of the following is a command of DDL?
1) Alter
2) Delete
3) Create
4) All of the Above

02
Round
Medium
Face to Face
Duration60
Interview date13 Nov 2023
Coding problem3

1. Chocolate Problem

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

Given an array/list of integer numbers 'CHOCOLATES' of size 'N', where each value of the array/list represents the number of chocolates in the packet. There are ‘M’ number of students and the task is to distribute the chocolate to their students. Distribute chocolate in such a way that:1. Each student gets at least one packet of chocolate.2. The difference between the maximum number of chocolate in a packet and the minimum number of chocolate in a packet given to the students is minimum.

Problem approach

Example :
Given 'N' : 5 (number of packets) and 'M' : 3 (number of students)
And chocolates in each packet is : {8, 11, 7, 15, 2}

All possible way to distribute 5 packets of chocolates among 3 students are -

( 8,15, 7 ) difference of maximum-minimum is ‘15 - 7’ = ‘8’
( 8, 15, 2 ) difference of maximum-minimum is ‘15 - 2’ = ‘13’ 
( 8, 15, 11 ) difference of maximum-minimum is ‘15 - 8’ = ‘7’
( 8, 7, 2 ) difference of maximum-minimum is ‘8 - 2’ = ‘6’
( 8, 7, 11 ) difference of maximum-minimum is ‘11 - 7’ = ‘4’
( 8, 2, 11 ) difference of maximum-minimum is ‘11 - 2’ = ‘9’
( 15, 7, 2 ) difference of maximum-minimum is ‘15 - 2’ = 13’
( 15, 7, 11 ) difference of maximum-minimum is ‘15 - 7’ = ‘8’
( 15, 2, 11 ) difference of maximum-minimum is ‘15 - 2’ = ‘13’
( 7, 2, 11 ) difference of maximum-minimum is ‘11 - 2’ = ‘9’

Hence there are 10 possible ways to distribute ‘5’ packets of chocolate among the ‘3’ students and difference of combination (8, 7, 11) is ‘maximum - minimum’ = ‘11 - 7’ = ‘4’ is minimum in all of the above.

Try solving now

2. Boundary Traversal of Binary Tree

Hard
20m average time
85% success
0/120
Asked in companies
SalesforceAmazonGoldman Sachs

You are given a binary tree having 'n' nodes.The boundary nodes of a binary tree include the nodes from the left and right boundaries and the leaf nodes, each node considered once.Figure out the boundary nodes of this binary tree in an Anti-Clockwise direction starting from the root node.

Problem approach

Explanation: As shown in the figure
The nodes on the left boundary are [10, 5, 3]
The nodes on the right boundary are [10, 20, 25]
The leaf nodes are [3, 7, 18, 25].
Please note that nodes 3 and 25 appear in two places but are considered once.

Try solving now

3. Longest Mountain Subarray

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

An array arr is a mountain if the following properties hold:arr.length >= 3.

There exists some i with 0 < i < arr.length - 1 such that:arr[0] < arr[1] < ... < arr[i - 1] < arr[i] arr[i] > arr[i + 1] > ... > arr[arr.length - 1].

Given a mountain array arr, return the index i such that arr[0] < arr[1] < ... < arr[i - 1] < arr[i] > arr[i + 1] > ... > arr[arr.length - 1].

You must solve it in O(log(arr.length)) time complexity.

Problem approach

Binary Search - O(log(n)) time complexity
In each iteration, we check the mid: if it's smaller than the next element, it's on the left side of the mountain and we have to continue searching in the right side of mid. So low = mid+1. Otherwise, high = mid-1.

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

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by ShareChat
1639 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 3 problems
Interviewed by ShareChat
1756 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 6 problems
Interviewed by ShareChat
1157 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by ShareChat
1230 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114579 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57825 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34961 views
7 comments
0 upvotes