Infosys private limited interview experience Real time questions & tips from candidates to crack your interview

SDE

Infosys private limited
upvote
share-icon
2 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 12 months
Topics: DSA , OOPS , OS, CN, Algorithms, DBMS , Dynamic Programming , Graphs.
Tip
Tip

Tip 1 : Do DSA 
Tip 2 : Do Extra Subjects
Tip 3 : Prepare some Projects

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

Tip 1 : Do Mention coding profiles in resume
Tip 2 : Do add summary of Projects

Interview rounds

01
Round
Medium
Online Coding Test
Duration180 minutes
Interview date3 Mar 2022
Coding problem3

3 Questions
1st - Trees
2nd - Greedy
3rd - DP

1. LCA Of Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
Tata Consultancy Services (TCS)RIVIGOGrab

You have been given a Binary Tree of distinct integers and two nodes ‘X’ and ‘Y’. You are supposed to return the LCA (Lowest Common Ancestor) of ‘X’ and ‘Y’.


The LCA of ‘X’ and ‘Y’ in the binary tree is the shared ancestor of ‘X’ and ‘Y’ that is located farthest from the root.


Note :
You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For example :
For the given binary tree

Example

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
Problem approach

first i had stored parent array of root->node1 and root->node2 (to fins lca of node1 and node2)
then the first common element in path is lca
T.C -> O(n)
S.C -> O(n)

Try solving now

2. Fractional Knapsack

Easy
15m average time
85% success
0/40
Asked in companies
MicrosoftSwiggyTata 1mg

You have been given weights and values of ‘N’ items. You are also given a knapsack of size ‘W’.

Your task is to put the items in the knapsack such that the total value of items in the knapsack is maximum.

Note:
You are allowed to break the items.
Example:
If 'N = 4' and 'W = 10'. The weights and values of items are weights = [6, 1, 5, 3] and values = [3, 6, 1, 4]. 
Then the best way to fill the knapsack is to choose items with weight 6, 1 and  3. The total value of knapsack = 3 + 6 + 4 = 13.00   
Problem approach

made the value array which is price/Wt array 
sorted that array
Started Taking Element from last until bag is Full
T.C -> O(nlogn)
S.c -> O(n)

Try solving now

3. Subset Sum

Easy
0/40
Asked in companies
AmazonTata 1mgOla

You are given an array 'nums' of ‘n’ integers.


Return all subset sums of 'nums' in a non-decreasing order.


Note:
Here subset sum means sum of all elements of a subset of 'nums'. A subset of 'nums' is an array formed by removing some (possibly zero or all) elements of 'nums'.


For example
Input: 'nums' = [1,2]

Output: 0 1 2 3

Explanation:
Following are the subset sums:
0 (by considering empty subset)
1 
2
1+2 = 3
So, subset sum are [0,1,2,3].
Problem approach

firstly solved through recursion by exponential complexity
then memoized it.
Time complexity:- O(n*w)

Try solving now
02
Round
Easy
Face to Face
Duration45 minutes
Interview date2 Apr 2022
Coding problem2

I was asked 2 coding questions
1st -> Linkedlist
2nd -> Priority Queue

1. Middle of a given linked list

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

Given a singly linked list of 'N' nodes. The objective is to determine the middle node of a singly linked list. However, if the list has an even number of nodes, we return the second middle node.

Note:
1. If the list is empty, the function immediately returns None because there is no middle node to find.
2. If the list has only one node, then the only node in the list is trivially the middle node, and the function returns that node.
Problem approach

I had used slow/fast pointer approach 
slow pointer is moved by 1 dist and fast by 2 
when fast ptr will reach null, slow will be at middle element

Try solving now

2. Last Stone Weight

Easy
27m average time
0/40
Asked in companies
Samsung R&D InstituteExpedia GroupCitrix

We have a collection of 'N' stones, each stone has a positive integer weight.

On each turn, we choose the two heaviest stones and smash them together. Suppose the stones have weights 'x' and 'y' with 'x' <= 'y'. The result of this smash will be:

1. If 'x' == 'y', both stones are totally destroyed;

2. If 'x' != 'y', the stone of weight 'x' is totally destroyed, and the stone of weight 'y' has a new weight equal to 'y - x'.

In the end, there is at most 1 stone left. Return the weight of this stone or 0 if there are no stones left.

Problem approach

I had taken the top 2 elements from priority queue and pushed their absolute difference back(if > 0)
and continued the process until one stone is remained in pq
T.C -> O(nlogn)
S.C -> O(n)

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

To make an AI less repetitive in a long paragraph, you should increase:

Choose another skill to practice
Similar interview experiences
System Engineer Specialist
2 rounds | 4 problems
Interviewed by Infosys private limited
1453 views
0 comments
0 upvotes
SDE
2 rounds | 5 problems
Interviewed by Infosys private limited
1468 views
0 comments
0 upvotes
SDE
2 rounds | 4 problems
Interviewed by Infosys private limited
0 views
0 comments
0 upvotes
Software Engineer
3 rounds | 3 problems
Interviewed by Infosys private limited
1174 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE
3 rounds | 6 problems
Interviewed by PhonePe
0 views
0 comments
0 upvotes
company logo
SDE
2 rounds | 6 problems
Interviewed by Tata Consultancy Services (TCS)
2132 views
0 comments
0 upvotes
company logo
SDE
5 rounds | 8 problems
Interviewed by Mathworks
1203 views
0 comments
0 upvotes