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

Specialist Programmer

Infosys private limited
upvote
share-icon
3 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Journey
In 2022, I successfully navigated all three rounds of the Specialist Programmer selection process at Infosys, which included two rounds of coding and one round of data structures and algorithms (DSA) based interviews. My strong performance in these assessments earned me a spot in the Power Programmer Internship in 2023. During my internship, I was subsequently offered a full-time position as a Specialist Programmer. This journey reflects my dedication and the continuous effort I put into enhancing my technical skills. If you aspire to follow a similar path, focus on honing your coding and DSA skills, which are critical to success.
Application story
I applied for the InfyTQ first round in December 2021. The first coding round took place in February 2022, followed by the second round in March. After successfully clearing these, I had my interview in April. The results were announced in July, and due to my high overall scores, I was offered the Power Programmer Internship starting in February 2023. The internship lasted until July, and based on my performance, I received a full-time offer in August as a Specialist Programmer. This journey highlights the importance of persistence and continuous improvement. If you're pursuing a similar path, maintain your focus and keep refining your skills in coding and DSA.
Why selected/rejected for the role?
I believe my selection for the role was due to a combination of several key factors. Firstly, my strong technical skills and problem-solving abilities, which I demonstrated during InfyTQ and HackWithInfy, were critical. Additionally, my performance during the internship, where I not only showcased technical expertise but also excelled in collaboration and innovation, was a significant contributor. This entire journey has underscored the importance of continuous learning, adaptability, and the value of demonstrating skills beyond traditional assessments. These experiences have been instrumental in shaping my approach to preparation and professional development.
Preparation
Duration: 6 Months
Topics: Data Structures, OOPS, DBMS, Trees, Dynamic Programming, Greedy Algorithms
Tip
Tip

Tip 1: Practice DSA daily.
Tip 2: Participate in coding contests.
Tip 3: Create meaningful projects.

Application process
Where: Other
Eligibility: Above 60% in all semesters with no backlogs
Resume Tip
Resume tip

Tip 1: Include all your projects and be ready to explain them. 

Tip 2: Include any internships if there are any.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration180 minutes
Interview date8 Feb 2022
Coding problem3

This was an online round where the first 90 minutes were dedicated to MCQ-based questions related to DBMS, OOPS, and OS concepts. After that, there were another 90 minutes for three easy-level coding questions mainly based on arrays and strings. This round started at 10 AM.

1. Common Elements In Three Sorted Arrays

Moderate
35m average time
65% success
0/80
Asked in companies
MicrosoftOptumSAP Labs

Given three arrays sorted in increasing order. Find the elements that are common in all three arrays.

Problem approach

To find the common elements in three sorted arrays without using any additional data structures and handling duplicates, we can follow a structured approach. This involves using three-pointers, one for each array, and iterating through the arrays in a synchronized manner. Here's a step-by-step approach:

Step-by-Step Approach
1. Initialize Pointers:
Start by initializing three-pointers, each pointing to the start of one of the three arrays. Let these pointers be i, j, and k for arrays A, B, and C, respectively.

2. Iterate Through Arrays:
Use a while loop to traverse the arrays. The loop should continue until any one of the pointers reaches the end of its respective array.

3. Compare Elements:
At each step of the loop, compare the elements pointed to by i, j, and k.
If the elements are equal (i.e., A[i] == B[j] == C[k]), print or store this element as it is common to all three arrays. Then, increment all three pointers (i, j, and k).

4. Move the Pointer with the Smallest Element:
If the elements are not equal, increment the pointer which points to the smallest element among A[i], B[j], and C[k]. This ensures that we move past the smaller elements in search of a common one.

5. Skip Duplicates:
To handle duplicates, make sure to skip over any duplicate elements in each array. This can be done by incrementing the pointers while the next element is the same as the current element.

Try solving now

2. N-th Fibonacci Number

Moderate
40m average time
70% success
0/80
Asked in companies
HCL TechnologiesCiscoNatwest Group

Given a positive integer n, find the nth Fibonacci number. Since the answer can be very large, return the answer modulo 1000000007.

Problem approach

There are two key aspects to solving this problem efficiently:

Recursion with Memoization: The standard Fibonacci definition involves recursion, where the nth term is derived from the two preceding terms. However, for large n, this approach can lead to redundant calculations. Memoization stores the previously computed Fibonacci numbers to avoid recalculating them.

Modulo Operation: Since the answer can be very large, we perform the modulo operation % 1000000007 at each step to keep the intermediate results within the defined range. This prevents overflow and ensures efficient computation.

Here's a step-by-step explanation of the algorithm:
1.Define Base Cases: Set fib(0) = 0 and fib(1) = 1.
2. Create Memoization Array: Initialize an array dp of size n+1 with all values marked as "not calculated yet" (e.g., -1).
3. Recursive Function: Define fib(n) that takes n (index) and dp (memoization array).
4. Lookup or Calculate:
a. If dp[n] is not "not calculated yet", return dp[n].
b. Otherwise, calculate fib(n-1) + fib(n-2) with modulo operation at each step.
5. Store and Return: Store the calculated value in dp[n] and return it.

Try solving now

3. Anagram

Moderate
30m average time
60% success
0/80
Asked in companies
JP MorganNearbuyTata Consultancy Services (TCS)

Given two strings and consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not.

Problem approach

A step-by-step explanation of how to check if two strings are anagrams:

1. Preprocessing (Optional):

Convert both strings a and b to lowercase. This ensures that characters like 'a' and 'A' are treated as the same.

2. Character Counting:
Create a hash table (or dictionary) char_count. This will store the frequency of each character encountered.

3. Iterate over First String:
Loop through each character in string a.
For each character:
If the character already exists in char_count, increment its count by 1.
If the character doesn't exist in char_count, add it to the dictionary with a count of 1.

4. Iterate over Second String:
Loop through each character in string b.
For each character:
Check if the character exists in char_count.
If the character doesn't exist in char_count or its count is already 0, it implies the characters are not balanced and the strings are not anagrams. Return False in this case.
If the character exists and has a count greater than 0, decrement its count in char_count.

5. Anagram Check:
After iterating through both strings, check if any character count in char_count is still greater than 0. This indicates unequal character frequencies and the strings are not anagrams. Return False.

6. Confirmation:
If all character counts in char_count are 0, it implies both strings have the same characters with the same frequencies. Therefore, a and b are anagrams. Return True.
By following these steps, you can efficiently compare two strings and determine if they are anagrams based on their character composition.

Try solving now
02
Round
Hard
Online Coding Test
Duration180 minutes
Interview date8 Mar 2022
Coding problem3

Three hard questions were to be solved in three hours. Each question had 10 test cases, and you had to pass all 10 to get 100% marks for that question. This round also started at 10 AM.

1. Merge Two Sorted Arrays

Moderate
15m average time
85% success
0/80
Asked in companies
AmazonOlaTata Consultancy Services (TCS)

Given two sorted arrays arr1[] and arr2[] of sizes n and m in non-decreasing order. Merge them in sorted order without using any extra space. Modify arr1 so that it contains the first N elements and modify arr2 so that it contains the last M elements

Problem approach

Step-by-Step Approach

1.Initialization:
Initialize three pointers: i pointing to the last non-zero element in arr1, j pointing to the last element in arr2, and k pointing to the last index of the combined array (N + M - 1).

2.Comparison and Placement:
Compare elements at arr1[i] and arr2[j].
If arr1[i] is greater than arr2[j], place arr1[i] at arr1[k] and decrement i.
If arr2[j] is greater than or equal to arr1[i], place arr2[j] at arr1[k] and decrement j.
Decrement k after each placement.

3.Handling Remaining Elements:
Continue the above steps until i or j becomes less than 0.
If there are remaining elements in arr2, copy them to the beginning of arr1 starting from index 0.

Try solving now

2. Maximum Sum Path Of A Binary Tree.

Hard
25m average time
75% success
0/120
Asked in companies
HikeSamsungDirecti

Given a binary tree in which each node element contains a number. Find the maximum possible path sum from one special node to another special node.

Problem approach

Step-by-Step Approach

1.Define Special Nodes:
Identify the special nodes in the binary tree from which the maximum path sum needs to be calculated.

2.Define Recursive Function:
Create a recursive function that calculates the maximum path sum starting from a given node and traversing downwards.

3.Base Case:
Define the base case of the recursive function:
If the current node is None, return 0.
If the current node is one of the special nodes, return the value of that node.

4.Recursive Calls:
Recursively calculate the maximum path sum for the left and right subtrees:
left_max = Recursive call for the left subtree.
right_max = Recursive call for the right subtree.

5.Update Maximum Path Sum:
Calculate the maximum path sum considering three possibilities:
The path passing through the current node (node.val + left_max + right_max).
The path starting from the current node and extending to one of its subtrees (max(node.val + left_max, node.val + right_max)).
The path limited to the current node (node.val).

6.Return Maximum Path Sum:
Return the maximum of the three possibilities calculated in the previous step.

Try solving now

3. Longest Valid Substring

Moderate
15m average time
85% success
0/80
Asked in companies
AmazonHCL TechnologiesTata Consultancy Services (TCS)

Given a string S consisting of opening and closing parenthesis '(' and ')'. Find length of the longest valid parenthesis substring.

A parenthesis string is valid if:

For every opening parenthesis, there is a closing parenthesis.
Opening parenthesis must be closed in the correct order.

Problem approach

Step-by-Step Approach

1.Initialize Variables:
Initialize a variable max_length to store the maximum length of valid parenthesis substring found so far.
Initialize a stack to store the indices of opening parentheses.

2.Iterate Through the String:
Iterate through each character of the string.

3.Process Opening Parentheses:
If the current character is an opening parenthesis '(', push its index onto the stack.

4.Process Closing Parentheses:
If the current character is a closing parenthesis ')':
If the stack is not empty and the top element of the stack contains the index of an opening parenthesis, pop the stack and calculate the length of the valid parenthesis substring ending at the current index.
Update max_length with the maximum of its current value and the calculated length.

5.Update max_length:
After processing all characters, max_length will contain the length of the longest valid parenthesis substring.

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date30 Apr 2022
Coding problem2

This was a video calls based Interview round. Many theoretical questions related to OS, DBMS and OOPS were asked. Different SQL queries were asked.

1. DBMS

Get the second highest salary from a user database.

Problem approach

Tip 1:Listen to the questions carefully.
Tip 2: You have to order the salaries in descending order and choose the second row.
Tip 3:Be aware of any special cases the interviewer throws at you.

2. Find All Subsets

Moderate
15m average time
90% success
0/80
Asked in companies
Tata Consultancy Services (TCS)Flipkart limitedUnthinkable Solutions

Given an integer array nums of unique elements, return all possible 
subsets
(the power set).

The solution set must not contain duplicate subsets.

Problem approach

Step-by-Step Approach

1.Initialize Results:
Initialize an empty list to store all subsets.
Add an empty subset to the list to start the generation process.

2.Iterate Through Elements:
Iterate through each element of the input array nums.

3.Generate New Subsets:
For each element, iterate through the existing subsets in the result list.
Create a new subset by adding the current element to each existing subset.
Add the new subset to the result list.

4.Combine Subsets:
After iterating through all elements, the result list will contain all subsets of size 1.
Combine these subsets to generate subsets of larger sizes.
Iterate through the result list and combine each subset with every other subset to form larger subsets.
Add the combined subsets to the result list.

5.Return Results:
Once all subsets have been generated, return the final result list containing all unique subsets.

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
Specialist Programmer
2 rounds | 4 problems
Interviewed by Infosys private limited
924 views
0 comments
0 upvotes
Specialist Programmer
2 rounds | 3 problems
Interviewed by Infosys private limited
875 views
0 comments
0 upvotes
Specialist Programmer
2 rounds | 11 problems
Interviewed by Infosys private limited
1238 views
0 comments
0 upvotes
Specialist Programmer
2 rounds | 4 problems
Interviewed by Infosys private limited
130 views
0 comments
0 upvotes