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

SDE - 1

PharmEasy
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practise 5 problems daily from websites like hackerrank, codechef, codeforces
Tip 2 : Participate in codechef, codeforces contest.
Tip 3 : Attend mock interviews and should have good communication skills.

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

Tip 1 : Maintain atleast 2 different projects, write powerful summary statement.
Tip 2 : Maintain skills relevant to job description, include relevant experience.

Interview rounds

01
Round
Medium
Video Call
Duration45 minutes
Interview date6 Sep 2022
Coding problem2

1. Square Root Of An Integer

Easy
20m average time
80% success
0/40
Asked in companies
GoogleTata 1mgOracle

You are given an integer ‘A’. Your task is to find the greatest non-negative integer whose square is less than or equal to ‘A’.

Square of a number is the product of the number with itself. For e.g. square of 3 is 9.

Problem approach

You are given an integer ‘A’. Your task is to find the greatest non-negative integer whose square is less than or equal to ‘A’.
Square of a number is the product of the number with itself. For e.g. square of 3 is 9.
Input Format
The first line of input contains an integer ‘T’ denoting the number of test cases to run. Then the test cases follow.

The first line of each test case contains a single integer ‘A’.
Output Format
For each test case, print the greatest positive integer whose square is less than or equal to ‘A’.

Print the output of each test case in a separated line.
Note
You do not need to print anything; it has already been taken care of. Just implement the given function.

Try solving now

2. LCA - Lowest Common Ancestor

Hard
40m average time
70% success
0/120
Asked in companies
SamsungDell TechnologiesMyntra

The lowest common ancestor (LCA) is a concept in graph theory and computer science.

Let ‘T’ be a rooted tree with ‘N’ nodes. The lowest common ancestor is defined between two nodes, ‘u’ and ‘v’, as the lowest node in ‘T’ that has both ‘u’ and ‘v’ as descendants (where we allow a node to be a descendant of itself). - Wikipedia

For the given tree, The LCA of nodes 5 and 8 will be node 2, as node 2 is the first node that lies in the path from node 5 to root node 1 and from node 8 to root node 1.

Path from node 5 to root node looks like 5 → 2 → 1.

Path from node 8 to root node looks like 8 → 6 → 2 → 1.

Since 2 is the first node that lies in both paths. Hence LCA will be 2.

Given any two nodes ‘u’ and ‘v’, find the LCA for the two nodes in the given Tree ‘T’.

Note: For each test case, the tree is rooted at node 1.

Problem approach

The lowest common ancestor (LCA) is a concept in graph theory and computer science.
Let ‘T’ be a rooted tree with ‘N’ nodes. The lowest common ancestor is defined between two nodes, ‘u’ and ‘v’, as the lowest node in ‘T’ that has both ‘u’ and ‘v’ as descendants (where we allow a node to be a descendant of itself). - Wikipedia

For the given tree, The LCA of nodes 5 and 8 will be node 2, as node 2 is the first node that lies in the path from node 5 to root node 1 and from node 8 to root node 1.
Path from node 5 to root node looks like 5 → 2 → 1.
Path from node 8 to root node looks like 8 → 6 → 2 → 1.
Since 2 is the first node that lies in both paths. Hence LCA will be 2.
Given any two nodes ‘u’ and ‘v’, find the LCA for the two nodes in the given Tree ‘T’.
Note: For each test case, the tree is rooted at node 1.

Try solving now
02
Round
Medium
Video Call
Duration45 minutes
Interview date6 Sep 2022
Coding problem2

1. Maximum profit

Moderate
40m average time
75% success
0/80
Asked in companies
Tata 1mgPharmEasyTata Consultancy Services (TCS)

Ninja is a poor but an intelligent boy. He has a rod of length ‘N’ units. He wants to earn maximum money by selling this rod in the market. So he cuts the rod into different sizes and each size has a cost associated with it. Determine the maximum money he can earn by cutting the rod and selling its pieces.

Note:
1. The sizes will range from 1 to ‘N’ and will be integers.

2. The sum of the pieces cut should be equal to ‘N’.

3. Consider 1-based indexing.
Problem approach

Ninja is a poor but an intelligent boy. He has a rod of length ‘N’ units. He wants to earn maximum money by selling this rod in the market. So he cuts the rod into different sizes and each size has a cost associated with it. Determine the maximum money he can earn by cutting the rod and selling its pieces.

Try solving now

2. Minimum Sum of Absolute Differences

Easy
10m average time
90% success
0/40
Asked in companies
OlaTata 1mgPharmEasy

You have been given two arrays/lists 'ARR1' and 'ARR2' of length 'N'. Your task is to pair each element of 'ARR1' to an element of 'ARR2' such that the sum of the absolute difference of all pairs is minimum.

Example:
If 'ARR1' = [0, 2, 1], and 'ARR2' = [8, 10, 4] then the most optimal pairing will be (0, 4) , (1, 8) and (2, 10). The sum of absolute difference will be 4 + 7 + 8 = 19.
Note:
An element from one array can make a pair only with at most one element of another array.
Problem approach

You have been given two arrays/lists 'ARR1' and 'ARR2' of length 'N'. Your task is to pair each element of 'ARR1' to an element of 'ARR2' such that the sum of the absolute difference of all pairs is minimum.
Example:
If 'ARR1' = [0, 2, 1], and 'ARR2' = [8, 10, 4] then the most optimal pairing will be (0, 4) , (1, 8) and (2, 10). The sum of absolute difference will be 4 + 7 + 8 = 19.

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 3 + 2 * 4 based on operator precedence?

Choose another skill to practice
Similar interview experiences
SDE - 1
2 rounds | 4 problems
Interviewed by PharmEasy
854 views
0 comments
0 upvotes
SDE - 1
2 rounds | 4 problems
Interviewed by PharmEasy
1165 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 9 problems
Interviewed by Salesforce
1609 views
0 comments
0 upvotes
company logo
System Engineer
2 rounds | 2 problems
Interviewed by Tata Consultancy Services (TCS)
1315 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
109330 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
53406 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
32803 views
6 comments
0 upvotes