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

SDE - 1

Cognizant
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Participate in programming competitions and practice at least 100 questions.
Tip 2 : Get an internship experience or take part in hackathons.
Tip 3 : Be comfortable with the OOP concept and fundamental programming principles.

Application process
Where: Campus
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1 : Keep your resume concise.
Tip 2 : Try mentioning all your skills on the resume.
Tip 3 : Don't forget to add your best projects and certificates.

Interview rounds

01
Round
Easy
Online Coding Test
Duration50 minutes
Interview date15 Sep 2022
Coding problem2

- Morning time
- Environment was good.
- Interviewer was good

1. Largest subarray with equal number of 0s and 1s

Moderate
10m average time
85% success
0/80
Asked in companies
PayPalMedia.netMorgan Stanley

You are given an array consisting of 0s and 1s. You need to find the length of the largest subarray with an equal number of 0s and 1s.

For example:

If the given array is: [0, 0, 1, 0, 1] The largest subarray would be: [0, 1, 0, 1] (last 4 elements) having length 4.
Problem approach

Step 1 : An easy problem is solved by changing the counter to 1 every time one comes after 0 or vice versa.
Step 2 : The maximum value is to be stored at the time of each swap.

Try solving now

2. Median of two sorted arrays

Hard
25m average time
65% success
0/120
Asked in companies
IBMAmazonAdobe

Given two sorted arrays 'a' and 'b' of size 'n' and 'm' respectively.


Find the median of the two sorted arrays.


Median is defined as the middle value of a sorted list of numbers. In case the length of list is even, median is the average of the two middle elements.


The expected time complexity is O(min(logn, logm)), where 'n' and 'm' are the sizes of arrays 'a' and 'b', respectively, and the expected space complexity is O(1).


Example:
Input: 'a' = [2, 4, 6] and 'b' = [1, 3, 5]

Output: 3.5

Explanation: The array after merging 'a' and 'b' will be { 1, 2, 3, 4, 5, 6 }. Here two medians are 3 and 4. So the median will be the average of 3 and 4, which is 3.5.
Problem approach

Step 1 : The problem came with getting the test cases done within the time limit, which was O(log(N1+N2)).
Step 2 : Solved the problem by using Binary Search implementation.

Try solving now
02
Round
Medium
Group Discussion
Duration90 minutes
Interview date28 Sep 2022
Coding problem1

- Morning time
- Environment was good.
- Interviewer was good

1. Group Discussion

Terrorism is un-doubtedly one of the most dangerous problem our country is facing. What do you think India can do to get rid by terrorism?

Problem approach

Stay in a formal manner and wait for your turn.

03
Round
Easy
Face to Face
Duration90 minutes
Interview date25 Nov 2022
Coding problem2

- Morning time
- Environment was good.
- Interviewer was good

1. Minimum Cost Path

Moderate
25m average time
70% success
0/80
Asked in companies
Goldman SachsOlaSalesforce

You have been given a matrix of ‘N’ rows and ‘M’ columns filled up with integers. Find the minimum sum that can be obtained from a path which from cell (x,y) and ends at the top left corner (1,1).

From any cell in a row, we can move to the right, down or the down right diagonal cell. So from a particular cell (row, col), we can move to the following three cells:

Down: (row+1,col)
Right: (row, col+1)
Down right diagonal: (row+1, col+1)
Problem approach

Step 1 : I had practiced enough DP questions.
Step 2 : So this one looked pretty easy. Since it was a standard DP question, the same approach worked here too.

Try solving now

2. Convert Decimal To Irreducible Fraction

Easy
25m average time
75% success
0/40
Asked in companies
HCL TechnologiesTata Consultancy Services (TCS)Microsoft

You are given a real number, 'NUM'. You have to represent this number as an irreducible fraction of the form A/B, where 'A' and 'B' are the numerator and denominator respectively.

A fraction is called irreducible when the greatest common divisor (GCD/HCF) of the numerator and denominator is one.

Example :
Given 'NUM' : 1.75
Irreducible fraction  can be represented as 7/4.

Note that 14/8 = 1.75 as well, but 14/8 is not an irreducible fraction.
Note :
In order to preserve precision, the real number will be given to you in the form of two strings : the integer part, and the fractional part. 

The integer part will contain not more than 8 digits, whereas the fractional part will always contain 8 digits.
Problem approach

Step 1 : I was unable to solve this question in given time.
Step 2 : I thought of using decimal precision and other things but not able to solve this.

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
company logo
SDE - 1
2 rounds | 5 problems
Interviewed by Cognizant
1745 views
1 comments
0 upvotes
company logo
SDE - 1
2 rounds | 6 problems
Interviewed by Cognizant
1760 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 6 problems
Interviewed by Cognizant
1798 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 9 problems
Interviewed by Cognizant
909 views
0 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)
6877 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by BNY Mellon
6240 views
3 comments
0 upvotes