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

SDE - 1

Infosys
upvote
share-icon
2 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 1 month
Topics: OOPS, System Design, Dynamic Programming, Algorithms, Data Structures.
Tip
Tip

Tip 1 : Go through all the previous available interview experiences.
Tip 2 : Practice atleast 10-20 every topic problems in coding.

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

Tip 1 : Personal Projects should be mentioned.
Tip 2 : CGPA asked should be at least 7.

Interview rounds

01
Round
Hard
Online Coding Interview
Duration60 minutes
Interview date3 Jan 2021
Coding problem3

It was a pure DS based round. It consists of three questions

1. Longest Common Subsequence

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

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

It's a standard problem can be found at various sites on the internet. So, I applied the approach that I practised earlier for this question

Try solving now

2. Reverse List In K Groups

Hard
15m average time
85% success
0/120
Asked in companies
InfosysHSBCAmazon

You are given a linked list of 'n' nodes and an integer 'k', where 'k' is less than or equal to 'n'.


Your task is to reverse the order of each group of 'k' consecutive nodes, if 'n' is not divisible by 'k', then the last group of nodes should remain unchanged.


For example, if the linked list is 1->2->3->4->5, and 'k' is 3, we have to reverse the first three elements, and leave the last two elements unchanged. Thus, the final linked list being 3->2->1->4->5.


Implement a function that performs this reversal, and returns the head of the modified linked list.


Example:
Input: 'list' = [1, 2, 3, 4], 'k' = 2

Output: 2 1 4 3

Explanation:
We have to reverse the given list 'k' at a time, which is 2 in this case. So we reverse the first 2 elements then the next 2 elements, giving us 2->1->4->3.


Note:
All the node values will be distinct.


Problem approach

It's a standard problem can be found at various sites on the internet.

Try solving now

3. Travelling Salesman Problem

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

Given a list of cities numbered from 0 to N-1 and a matrix 'DISTANCE' consisting of 'N' rows and 'N' columns denoting the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the starting city?

Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date4 Feb 2021
Coding problem2

A single coding question and one puzzle was asked in this round. Both were of easy level difficulty. I was given enough time for solving this.

1. Implement a phone directory

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

You are given a list/array of strings which denotes the contacts that exist in your phone directory. The search query on a string ‘str’ which is a query string displays all the contacts which are present in the given directory with the prefix as ‘str’. One special property of the search function is that when a user searches for a contact from the contact list then suggestions (contacts with prefix as the string entered so for) are shown after the user enters each character.

Note :
If no suggestions are found, return an empty 2D array.
For Example :

alt text

In the above example everytime we enter a character, a few suggestions display the strings which contain the entered string as prefixes.
Try solving now

2. Puzzle

There are 100 doors, all closed. 

In a nearby cage are 100 monkeys.

The first monkey is let out and runs along the doors opening every one. 

The second monkey is then let out and runs along the doors closing the 2nd, 4th, 6th,… - all the even-numbered doors. 

The third monkey is let out. He attends only to the 3rd, 6th, 9th,… doors (every third door, in other words), closing any that is open and opening any that is closed, and so on. 

After all 100 monkeys have done their work in this way, what state are the doors in after the last pass?

Problem approach

Tip 1 : Listen to the problem carefully

Tip 2 : First create the solution in your mind and then give your answer.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you write a single-line comment in C++?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - 1
2 rounds | 2 problems
Interviewed by Infosys
1467 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Infosys
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Infosys
843 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 3 problems
Interviewed by Infosys
775 views
1 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
1 rounds | 2 problems
Interviewed by Tata Consultancy Services (TCS)
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 4 problems
Interviewed by Tata Consultancy Services (TCS)
5655 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by BNY Mellon
4899 views
3 comments
0 upvotes