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

Senior Software Engineer

Cognizant
upvote
share-icon
4 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Journey
My journey started when I was in 12th grade, and my teacher guided me to participate in coding competitions hosted by an online coding platform. After that, I started taking part in them regularly and developed a habit of solving coding questions.
Application story
I asked one of the employees to refer me based on my resume. Luckily, he referred me, and then the interviews started with three technical rounds and one HR round.
Why selected/rejected for the role?
I was selected because I was well-prepared for the interviews and ready for all sorts of questions.
Preparation
Duration: 4 months
Topics: Data Structures, Algorithms, OOPS, Operating Systems, Database Management, C++, or Java (proficient in anyone), and Computer Networks
Tip
Tip

Tip 1: I recommend practicing as many data structures and algorithms questions as possible. Regular practice will help you build strong concepts. You can also check out recent interview questions that are commonly asked.

Tip 2: If you have enough time before your interviews, I suggest using online coding platforms that offer a variety of problems sorted by topic and difficulty. Try solving at least 20-30 questions for each data structure and algorithm to strengthen your understanding.

Tip 3: Besides coding, make sure you have a clear understanding of basic concepts in operating systems and databases, as these topics are often discussed in interviews.

Application process
Where: Linkedin
Eligibility: 7 CGPA
Resume Tip
Resume tip

Tip 1: Your resume should primarily highlight your skills, projects, and achievements. Projects play a crucial role in your interview, so you should have at least one strong and relevant project that demonstrates your proficiency in development.

Tip 2: The most important tip is to never lie on your resume. If you have only worked with a technology for a project and do not have in-depth knowledge, you should mention only the basics in your resume.

Interview rounds

01
Round
Hard
Online Coding Test
Duration90 mins
Interview date12 May 2022
Coding problem1

The round consisted of three coding questions, and the test was conducted on the Mettl platform. There was no sectional time limit for the coding questions. Each student received three randomly assigned coding questions, and no two students had the same set of questions. The test was conducted online with both audio and video enabled for continuous monitoring.

1. Dice Throws

Hard
35m average time
65% success
0/120
Asked in companies
MakeMyTripMicrosoftDisney + Hotstar

You are given D dice, each having F faces numbered 1 to F, both inclusive. The task is to find the possible number of ways to roll the dice together such that the sum of face-up numbers equal the given target S.

Note :
As the answer can be large, return your answer modulo 10^9  + 7.
Follow Up :
Can you solve this using not more than O(S) extra space?
Problem approach

I used DP to solve this problem, with the number of dice directly used as the row index and the sum directly used as the column index. In the end, I returned the last element of the DP table.

Try solving now
02
Round
Easy
Video Call
Duration50 mins
Interview date6 May 2023
Coding problem2

This round was based on data structures and included some discussion about my projects. The interviewer was very calm and listened carefully to my solutions. There was extensive discussion about my projects, and the interviewer seemed very interested in learning about their workflows.

1. Check Identical Trees

Moderate
20m average time
85% success
0/80
Asked in companies
HikeDelhiveryMorgan Stanley

You are given two binary trees with 'n' and 'm' nodes respectively.


You need to return true if the two trees are identical. Otherwise, return false.


Example:
For the trees given below:- 

example

The given trees are identical as:-
1. The number of nodes in both trees is the same. 
2. The number of edges in both trees is the same. 
3. The data for root for both the trees is the same i.e 5. 
4. The data of root -> left (root’s left child) for both the trees is the same i.e 2.
5. The data of root -> right (root’s right child) for both the trees is the same i.e 3.
6. The data of root -> right -> left ( left child of root’s right child) for both the trees is the same i.e 6.
7. Nodes with data 2 and 6 are the leaf nodes for both the binary trees. 
Problem approach

I first solved the question using simple recursion by checking every node and then calling the left and right subtrees.
Then, the interviewer asked me to optimize it.
I explained to him that if we have to check their identity, we must traverse both trees fully.
He was satisfied with my explanation.

Try solving now

2. Distinct Subsequences

Easy
0/40
Asked in companies
AmazonMicrosoftInnovaccer

Given two strings S and T consisting of lower case English letters. The task is to count the distinct occurrences of T in S as a subsequence.

A subsequence is a sequence generated from a string after deleting some or no characters of the string without changing the order of the remaining string characters. (i.e. “ace” is a subsequence of “abcde” while “aec” is not).

For example, for the strings S = “banana” and T=”ban”, output is 3 as T appears in S as below three subsequences.

[ban], [ba n], [b an ]

Problem approach

I solved this question using recursion and a map. I made two recursive calls: one for including the element and one for excluding it. After reaching the end of the array, I pushed the subsequence to the resultant vector. I also checked for duplicates using the map.

The interviewer was satisfied with this approach after I explained the workflow to him and clarified that since we want all the subsequences, we need to use recursion.

Try solving now
03
Round
Medium
Video Call
Duration50 mins
Interview date6 May 2023
Coding problem1

This round was also based on data structures, and the interviewer was not responding as much as in the first round, allowing me to think on my own about whether I was on the right track or not. In this round, there was also a deep discussion about one of my web development projects involving machine learning. So, don't panic in such situations if the interviewer is not responding much, as they are carefully noting down every tiny detail of your written code.

1. Delete Kth node From End

Moderate
15m average time
95% success
0/80
Asked in companies
SquadstackExpedia GroupAmazon

You have been given a singly Linked List of 'N' nodes with integer data and an integer 'K'.


Your task is to remove the 'K'th node from the end of the given Linked List and return the head of the modified linked list.


Example:
Input : 1 -> 2 -> 3 -> 4 -> 'NULL'  and  'K' = 2
Output: 1 -> 2 -> 4 -> 'NULL'
Explanation:
After removing the second node from the end, the linked list become 1 -> 2 -> 4 -> 'NULL'.

altImage


Problem approach

I first found the length of the linked list and then calculated the difference between the length and N, which gave me the index of the node to be deleted from the beginning. After determining the index of the node to be deleted, I simply traversed the list up to that node and deleted it from memory.

The interviewer asked me to optimize the solution.

The initial solution had a time complexity of O(2n), so I optimized it to O(n) using the two-pointer approach. I maintained two pointers: first and second. The first pointer pointed to the head of the linked list, while the second pointer was positioned at the Nth node from the beginning. Then, I incremented both pointers simultaneously until the second pointer reached the last node of the linked list. This allowed me to identify and delete the Nth node from the end since I had the address of the node to be removed.

Try solving now
04
Round
Easy
HR Round
Duration40 mins
Interview date6 May 2023
Coding problem1

This was an HR/Coding round and was the final one. The coding question was to find the nth node from the end of the linked list which is similar to the one asked in the previous round. The interview started with 2-3 HR questions and after I answered all of them, there was a serious discussion on my projects like why you chose this project, what are its advantages, was it able to solve the existing problem. I answered all the project related queries very calmly and he was satisfied.

1. Project based questions

  • Why did you choose this project?
  • What are its advantages?
  • Was it able to solve the existing problem?

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
company logo
Senior Software Engineer
3 rounds | 7 problems
Interviewed by Cognizant
2245 views
0 comments
0 upvotes
company logo
Frontend Developer
3 rounds | 7 problems
Interviewed by Cognizant
2407 views
0 comments
0 upvotes
company logo
Programmer Analyst
3 rounds | 8 problems
Interviewed by Cognizant
951 views
0 comments
0 upvotes
company logo
Senior Software Engineer
2 rounds | 12 problems
Interviewed by Cognizant
1492 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Senior Software Engineer
1 rounds | 6 problems
Interviewed by Arcesium
3720 views
0 comments
0 upvotes
company logo
Senior Software Engineer
3 rounds | 3 problems
Interviewed by Ernst & Young (EY)
4954 views
0 comments
0 upvotes
company logo
Senior Software Engineer
3 rounds | 3 problems
Interviewed by HCL Technologies
2991 views
3 comments
0 upvotes