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

Genc Next

Cognizant
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: DSA , OOPS , OS, CN, Algorithms, DBMS , Dynamic Programming , Graphs
Tip
Tip

Tip 1 : Improve Communication Skills
Tip 2 : Do Extra Subjects
Tip 3 : Prepare some Projects

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

Tip 1 : Do Mention coding profiles in resume
Tip 2 : Do add summary of Projects

Interview rounds

01
Round
Easy
Online Coding Test
Duration60 Minutes
Interview date13 Oct 2021
Coding problem2

2 Coding questions

1. Pair Sum

Easy
15m average time
90% success
0/40
Asked in companies
GenpactWalmartCognizant

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.

Note:

Each pair should be sorted i.e the first value should be less than or equals to the second value. 

Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
Problem approach

This problem can be solved efficiently by using the technique of hashing. Use a hash_map to check for the current array value x(let), if there exists a value target_sum-x which on adding to the former gives target_sum.

Try solving now

2. Maximum Product Subarray

Moderate
25m average time
75% success
0/80
Asked in companies
AmazonMicrosoftSamsung

You are given an array “arr'' of integers. Your task is to find the contiguous subarray within the array which has the largest product of its elements. You have to report this maximum product.

An array c is a subarray of array d if c can be obtained from d by deletion of several elements from the beginning and several elements from the end.

For e.g.- The non-empty subarrays of an array [1,2,3] will be- [1],[2],[3],[1,2],[2,3],[1,2,3]. 
For Example:
If arr = {-3,4,5}.
All the possible non-empty contiguous subarrays of “arr” are {-3}, {4}, {5}, {-3,4}, {4,5} and {-3,4,5}.
The product of these subarrays are -3, 4, 5, -12, 20 and -60 respectively.
The maximum product is 20. Hence, the answer is 20.
Follow Up:
Can you solve this in linear time and constant space complexity?
Problem approach

1. If there are even number of negative numbers and no zeros, result is simply product of all

2. If there are odd number of negative numbers and no zeros, result is product of all except the negative integer with 
the least absolute value.

3. If there are zeros, result is product of all except these zeros with one exceptional case. The exceptional case is when 
there is one negative number and all other elements are 0. In this case, result is 0.

Try solving now
02
Round
Easy
HR Round
Duration30 Minutes
Interview date18 Nov 2022
Coding problem2

Few Aptitude questions were asked and few questions on Project were also asked

1. Puzzle

Two Dice Are Thrown Together Then The Probability That The Sum Of Numbers Appearing On Them Is A Prime Number Is?

Problem approach

When two dice are thrown, the total number of sample spaces is 36.

Favourable outcomes = {(1,1),(1,2),(1,4),(1,6),(2,3),(2,3),(2,5),(3,2),(3,4),(4,1),(4,3),(5,2),(5,6),(6,1),(6,5)}

Total number of favourable outcomes = 15

Hence, the probability of getting a sum of prime numbers = 15/36 = 5/12.

2. Project Based Question

I was asked to explain my Project and what problems i faced while making that?

Problem approach

Tip 1 : Prepare a brief Summary of your Project
Tip 2 : Don't Copy paste code in your Project
Tip 3 : Prepare a Decent Project and not the ones which are readily available on Google

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
Genc Next
2 rounds | 5 problems
Interviewed by Cognizant
1248 views
0 comments
0 upvotes
company logo
Genc Next
2 rounds | 7 problems
Interviewed by Cognizant
1733 views
0 comments
0 upvotes
company logo
Genc Next
3 rounds | 6 problems
Interviewed by Cognizant
866 views
0 comments
0 upvotes
company logo
Genc Next
3 rounds | 9 problems
Interviewed by Cognizant
1063 views
0 comments
0 upvotes