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

Genc Next

Cognizant
upvote
share-icon
2 rounds | 2 Coding problems

Interview preparation journey

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

Tip 1 : Practice questions online
Tip 2 : Resume should be confined
Tip 3 : Prepare your projects thoroughly and improve communication skills

Application process
Where: Campus
Eligibility: 6 CGPA
Resume Tip
Resume tip

Tip 1 : Resume should be confined
Tip 2 : Format of resume should be representable

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 minutes
Interview date16 Sep 2021
Coding problem1

It was a 90 minutes coding test containing 30 MCQs, 15 of DSA and 15 of logical reasoning with two coding questions. It was held in the afternoon.

1. 3Sum

Moderate
15m average time
85% success
0/80
Asked in companies
CiscoMathworksSamsung

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a triplet {ARR[i], ARR[j], ARR[k]} with sum = 'K' if there exists three indices i, j and k such that i!=j, j!=k and i!=j and ARR[i] + ARR[j] + ARR[k] = 'K'.

Note:
1. You can return the list of values in any order. For example, if a valid triplet is {1, 2, -3}, then {2, -3, 1}, {-3, 2, 1} etc is also valid triplet. Also, the ordering of different triplets can be random i.e if there are more than one valid triplets, you can return them in any order.
2. The elements in the array need not be distinct.
3. If no such triplet is present in the array, then return an empty list, and the output printed for such a test case will be "-1".
Problem approach

First sort it and then solve it with 2 pointer approach, check in every iteration

Try solving now
02
Round
Easy
Video Call
Duration30 minutes
Interview date23 Sep 2021
Coding problem1

30 minutes interview round in afternoon, where interviewer asked puzzles, about my background, about my projects.

1. Longest Substring Without Repeating Characters

Moderate
30m average time
65% success
0/80
Asked in companies
DunzoSliceCognizant

Given a string input of length n, find the length of the longest substring without repeating characters i.e return a substring that does not have any repeating characters.

Substring is the continuous sub-part of the string formed by removing zero or more characters from both ends.

Problem approach

Suppose we have a function boolean allUnique(String substring) which will return true if the characters in the substring are all unique, otherwise false. We can iterate through all the possible substrings of the given string s and call the function allUnique. If it turns out to be true, then we update our answer of the maximum length of substring without duplicate characters.

Now let's fill the missing parts:

To enumerate all substrings of a given string, we enumerate the start and end indices of them. Suppose the start and end indices are ii and jj, respectively. Then we have 0 \leq i \lt j \leq n0≤i
To check if one string has duplicate characters, we can use a set. We iterate through all the characters in the string and put them into the set one by one. Before putting one character, we check if the set already contains it. If so, we return false. After the loop, we return true.

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
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