Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Prochant India Pvt.Ltd interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Prochant India Pvt.Ltd
upvote
share-icon
3 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Journey
I started my journey in coding in my second year after being motivated by my seniors. I initially began by learning basic programming languages. Later, I started participating in contests on coding platforms and solving questions on the platform. I remained consistent in doing so. After 2-3 months, I was able to solve some questions on coding platforms. Then, in my third year, I studied core subjects like OS, DBMS, OOPS, and CN in depth. In this manner, I was well-prepared before the placement season.
Application story
I applied through the HackerEarth contest, where we first had to participate in their hackathon. After the hackathon, we received a call from the HR department that they were scheduling our interview now.
Why selected/rejected for the role?
I faced rejection due to an inadequate response time for answering questions; I needed to enhance my speed and efficiency in addressing queries.
Preparation
Duration: 6 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practice coding from coding platforms and do at least 100 questions.
Tip 2 : Practice any one automation framework includes design patterns

Application process
Where: Hackerrank
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1: Optimize your resume for conciseness by limiting it to a single page while emphasizing hands-on experience.
Tip 2: Showcase proficiency in key areas such as Selenium and Rest Assured automation, underscored by your use of Java as the primary programming language.

Interview rounds

01
Round
Easy
Face to Face
Duration45 minutes
Interview date6 Feb 2023
Coding problem2

1. Equilibrium Index

Easy
0/40
Asked in companies
GoogleAmazonWalmart

You are given an array Arr consisting of N integers. You need to find the equilibrium index of the array.

An index is considered as an equilibrium index if the sum of elements of the array to the left of that index is equal to the sum of elements to the right of it.

Note:

1. The array follows 0-based indexing, so you need to return the 0-based index of the element.
2. Note that the element at the equilibrium index won’t be considered for either left sum or right sum.
3. If there are multiple indices which satisfy the given condition, then return the left-most index i.e if there are indices i,j,k…. which are equilibrium indices, return the minimum among them
4. If no such index is present in the array, return -1.
Problem approach

The expectation was to solve this problem in O(n).
I traversed the array from both the end (left and right) and stooped where my int leftSum == int. rightSum.

Try solving now

2. Bottom View Of Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
OYOMicrosoftAmazon

You are given a 'Binary Tree'.


Return the bottom view of the binary tree.


Note :
1. A node will be in the bottom-view if it is the bottom-most node at its horizontal distance from the root. 

2. The horizontal distance of the root from itself is 0. The horizontal distance of the right child of the root node is 1 and the horizontal distance of the left child of the root node is -1. 

3. The horizontal distance of node 'n' from root = horizontal distance of its parent from root + 1, if node 'n' is the right child of its parent.

4. The horizontal distance of node 'n' from root = horizontal distance of its parent from the root - 1, if node 'n' is the left child of its parent.

5. If more than one node is at the same horizontal distance and is the bottom-most node for that horizontal distance, including the one which is more towards the right.


Example:
Input: Consider the given Binary Tree:

alt text

Output: 4 2 6 3 7

Explanation:
Below is the bottom view of the binary tree.

alt text

1 is the root node, so its horizontal distance = 0.
Since 2 lies to the left of 0, its horizontal distance = 0-1= -1
3 lies to the right of 0, its horizontal distance = 0+1 = 1
Similarly, horizontal distance of 4 = Horizontal distance of 2 - 1= -1-1=-2
Horizontal distance of 5 = Horizontal distance of 2 + 1=  -1+1 = 0
Horizontal distance of 6 = 1-1 =0
Horizontal distance of 7 = 1+1 = 2

The bottom-most node at a horizontal distance of -2 is 4.
The bottom-most node at a horizontal distance of -1 is 2.
The bottom-most node at a horizontal distance of 0 is 5 and 6. However, 6 is more towards the right, so 6 is included.
The bottom-most node at a horizontal distance of 1 is 3.
The bottom-most node at a horizontal distance of 2 is 7.

Hence, the bottom view would be 4 2 6 3 7


Problem approach

Initialize variable hd = 0, map m with int-int key value pair and queue q to store nodes level-wise.
Set root->hd = hd and push root in q.
Run a while loop till q is empty.
Store the front element in node temp and temp ->hd in variable hd and pop it then set temp->data as value for key hd in m i.e. m[hd] = temp->data. 
If temp -> left is not NULL and set temp->left->hd = hd-1 as well as If temp -> right is not NULL and set temp->right->hd = hd+1 respectively. 
Iterate over the keys and print the values.

Try solving now
02
Round
Easy
Face to Face
Duration60 minutes
Interview date7 Feb 2023
Coding problem2

1. Longest Repeating Substring

Moderate
10m average time
90% success
0/80
Asked in companies
IBMInfosysMakeMyTrip

You are given a string 'str' of length 'N'. You can perform at most 'k' operations on this string. In one operation, you can choose any character of the string and change it to any other uppercase English alphabet character.


Return the length of the longest substring containing same characters after performing the above operations.


For example :

Input:
str="AABC"  k=1

Output:3

Explanation: Replace 'B' with 'A', we will get "AAAC" and the longest substring with same character is "AAA" of length 3.
Problem approach

We check for the maximum length of the substring that can be formed by every character in a set of 52 characters (from 'A' to 'Z' and from 'a' to 'z'). To do this, we traverse the entire string, and whenever we find a different character, we increase the count. If the count becomes greater than k (at the right index), we start again from the 0th index, and if we find a different character, we decrease the count. When the count is equal to k (at the left index), the length will be rightIndex - leftIndex + 1. We repeat this process until we reach the end of the string, at which point we return the maximum length. We perform this for all characters and finally return the maximum length.

Try solving now

2. Longest Common Substring

Moderate
25m average time
75% success
0/80
Asked in companies
Wells FargoShareChatAdobe

You are given two strings, 'str1' and 'str2'. You have to find the length of the longest common substring.


A substring is a continuous segment of a string. For example, "bcd" is a substring of "abcd", while "acd" or "cda" are not.


Example:
Input: ‘str1’ = “abcjklp” , ‘str2’ = “acjkp”.

Output: 3

Explanation:  The longest common substring between ‘str1’ and ‘str2’ is “cjk”, of length 3.
Problem approach

Dynamic Programming can be used to find the longest common substring in O(m*n) time. The idea is to find the length of the longest common suffix for all substrings of both strings and store these lengths in a table. 

The longest common suffix has following optimal sub-structure property. 
If last characters match, then we reduce both lengths by 1 
LCSuff(X, Y, m, n) = LCSuff(X, Y, m-1, n-1) + 1 if X[m-1] = Y[n-1] 
If last characters do not match, then result is 0, i.e., 
LCSuff(X, Y, m, n) = 0 if (X[m-1] != Y[n-1])
Now, we consider suffixes of different substrings ending at different indexes. 
The maximum length Longest Common Suffix is the longest common substring. 
LCSubStr(X, Y, m, n) = Max(LCSuff(X, Y, i, j)) where 1 <= i <= m and 1 <= j <= n

Try solving now
03
Round
Medium
Face to Face
Duration60 minutes
Interview date8 Feb 2023
Coding problem3

1. Puzzle Question

There are 100 doors in a row, and all doors are initially closed. A person walks through all the doors multiple times and toggles (if a door is open, then close it; if it is closed, then open it) them in the following way:

In the first walk, the person toggles every door.

In the second walk, the person toggles every second door, i.e., the 2nd, 4th, 6th, 8th, etc.

In the third walk, the person toggles every third door, i.e., the 3rd, 6th, 9th, etc.

Likewise,

In the 100th walk, the person toggles the 100th door.

Which doors are open in the end?

2. Puzzle Question

In a one-day, international cricket match, considering no extras (no wides, no ‘no’ balls, etc.) and no overthrows.

What is the maximum number of runs that a batsman can score in an ideal case?

Problem approach

49*(6*5+3)+(6*6)= 1653

3. Overlapping Intervals

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

Given 'N' number of intervals, where each interval contains two integers denoting the boundaries of the interval. The task is to merge all the overlapping intervals and return the list of merged intervals sorted in ascending order.

Two intervals will be considered to be overlapping if the starting integer of one interval is less than or equal to the finishing integer of another interval, and greater than or equal to the starting integer of that interval.

Example:
for the given 5 intervals - [1,4], [3,5], [6,8], [10,12], [8,9].
Since intervals [1,4] and [3,5] overlap with each other, we will merge them into a single interval as [1,5].

Similarly [6,8] and [8,9] overlaps, we merge them into [6,9].

Interval [10,12] does not overlap with any interval.

Final List after merging overlapping intervals: [1,5], [6,9], [10,12]
Problem approach

Check if any two intervals overlap among a given set of intervals. An interval is given in form of start and end time. Given a set of intervals, check if any two intervals overlap or not.

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

When does a stack underflow occur?

Choose another skill to practice
Start a Discussion
Similar interview experiences
SDE - 1
3 rounds | 5 problems
Interviewed by Prochant India Pvt.Ltd
245 views
0 comments
0 upvotes
System Engineer
3 rounds | 5 problems
Interviewed by Prochant India Pvt.Ltd
257 views
0 comments
0 upvotes
SDE - 1
3 rounds | 5 problems
Interviewed by Prochant India Pvt.Ltd
226 views
0 comments
0 upvotes
SDE - 1
3 rounds | 5 problems
Interviewed by Prochant India Pvt.Ltd
235 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
105304 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
50208 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
31275 views
6 comments
0 upvotes