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

SDE

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

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures, My SQL, OOPS, Database, Algorithms, Dynamic Programming, Operating System
Tip
Tip

Tip 1 : Practice good number of questions on GFG/Leetcode
Tip 2 : Do at least 2 projects
 

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

Tip 1 : Have some good projects in your resume
Tip 2 : Do not put false things on resume.

Interview rounds

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

There were 3 coding quetions in this round from DSA. the two question was of medium level but one question was neither difficult nor medium level question.

1. 0 1 Knapsack

Easy
15m average time
85% success
0/40
Asked in companies
TwitterWalmartAmazon

A thief is robbing a store and can carry a maximal weight of W into his knapsack. There are N items and the ith item weighs wi and is of value vi. Considering the constraints of the maximum weight that a knapsack can carry, you have to find and return the maximum value that a thief can generate by stealing items.

Problem approach

Method 1: Recursion by Brute-Force algorithm OR Exhaustive Search.
Approach: A simple solution is to consider all subsets of items and calculate the total weight and value of all subsets. Consider the only subsets whose total weight is smaller than W. From all such subsets, pick the maximum value subset.
Optimal Sub-structure: To consider all subsets of items, there can be two cases for every item. 

Case 1: The item is included in the optimal subset.
Case 2: The item is not included in the optimal set.
Therefore, the maximum value that can be obtained from ‘n’ items is the max of the following two values. 

Maximum value obtained by n-1 items and W weight (excluding nth item).
Value of nth item plus maximum value obtained by n-1 items and W minus the weight of the nth item (including nth item).
If the weight of ‘nth’ item is greater than ‘W’, then the nth item cannot be included and Case 1 is the only possibility.

Method 2 : we can optimise the above method using DP

Try solving now

2. Gas Stations

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

You have been given a circular path. There are 'N' petrol pumps on this path that are numbered from 0 to N - 1 (Both inclusive). Each petrol pump has two values associated with it:

1)The amount of petrol that is available at this particular petrol pump.
2)The distance to reach the next petrol pump.

You are on a truck having an empty tank of infinite capacity. You can start the tour from any of the petrol pumps. Your task is to calculate the first petrol pump from where the truck will be able to complete the full circle or determine if it is impossible to do so.

You may assume that the truck will stop at every petrol pump and it will add the petrol from that pump to its tank. The truck will move one kilometre for each litre of petrol consumed.

Problem approach

A efficient solution would be to find out the first petrol pump where the amount of petrol is greater than or equal to the distance to be covered to reach the next petrol pump. Now we mark that petrol pump as start and now we check whether we can finish the journey towards the end point. If in the middle, at any petrol pump, the amount of petrol is less than the distance to be covered to reach the next petrol pump, then we can say we cannot complete the circular tour from start. We again try to find out the next point from where we can start our journey i.e. the next petrol pump where the amount of petrol is greater than or equal to the distance to be covered and we mark it as start. We need not look at any petrol pump in between the initial petrol pump marked as start and the new start as we know that we cannot complete the journey if we start from any middle petrol pump because eventually we will arrive at a point where amount of petrol is less than the distance. Now we repeat the process until we reach the last petrol pump and update our start as and when required. After we reach our last petrol pump, we try to reach our first petrol pump from the last and let’s say we have a remaining amount of petrol as curr_petrol. Now we again start traveling from the first petrol pump and take the advantage of our curr_petrol and try to reach the start. If we can reach the start, then we may conclude that start can be our starting point.

Try solving now

3. Longest Common Subsequence

Moderate
39m average time
0/80
Asked in companies
PayPalShareChatOla

Given two strings, 'S' and 'T' with lengths 'M' and 'N', find the length of the 'Longest Common Subsequence'.

For a string 'str'(per se) of length K, the subsequences are the strings containing characters in the same relative order as they are present in 'str,' but not necessarily contiguous. Subsequences contain all the strings of length varying from 0 to K.

Example :
Subsequences of string "abc" are:  ""(empty string), a, b, c, ab, bc, ac, abc.
Problem approach

step 1 : Sort the given array then I found the mathmatical formula to calculate the number of days i could buy that particular Sugar pack.
step 2 : Iterate the whole array and find the number of days then i can calculate number of sugar packs.

Try solving now
02
Round
Hard
Face to Face
Duration60 minutes
Interview date3 Apr 2022
Coding problem1

I was asked one Coding Question

1. Maximum Size Rectangle Sub-matrix With All 1's

Hard
10m average time
80% success
0/120
Asked in companies
HikeAdobeSamsung R&D Institute

You are given an 'N' * 'M' sized binary-valued matrix 'MAT, where 'N' is the number of rows and 'M' is the number of columns. You need to return the maximum size (area) of the submatrix which consists of all 1’s i.e. the maximum area of a submatrix in which each cell has only the value ‘1’.

subMatrix_image

In the above image, areas in green, red, and violet color are all submatrices of the original 4x4 matrix.

Note:

1. Binary valued matrix has only two values in each cell : 0 and 1.
2. A submatrix is a matrix formed by selecting certain rows and columns from a larger matrix.
3. The area of a matrix with 'h' rows and 'w' columns is equal to 'h' * 'w'. 
Problem approach

I have gave him a brute force approach in which i found all the reactange with all one for every index. but this was a very naive solution.

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
1102 views
0 comments
0 upvotes
SDE
2 rounds | 5 problems
Interviewed by Infosys private limited
1469 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