0 day streak

Cognizant coding interview questions

Service and IT India

Ranked by how often candidates report them. Each opens in the editor with hidden tests, an animated walkthrough and solutions in four languages; a question you solve once counts for every company that asks it.

0%ready
ProgressTitleDifficultyTopicHow often hereAlso asked atNext step
Two SumTwo Sum Easy Arrays & Hashing Google, Amazon, Microsoft +46 Solve
Palindrome NumberMath / Number Theory Easy Arrays & Hashing Bloomberg, Morgan Stanley, Qualcomm +10 Solve
Longest Substring Without Repeating CharactersSliding Window · Variable Medium Arrays & Hashing Google, Amazon, Microsoft +50 Solve
Longest Palindromic SubstringStrings Medium Dynamic Programming Amazon, Microsoft, Apple +22 Solve
Move ZeroesTwo Pointer Easy Arrays & Hashing Meta, Nvidia, Bloomberg +11 Solve
Valid ParenthesesStack Basics Easy Stack Google, Microsoft, Meta +39 Solve
Best Time to Buy and Sell StockState Machine DP - Stock Problems Easy Dynamic Programming Amazon, Microsoft, Apple +38 Solve
Fibonacci Number1D DP Easy Dynamic Programming Spotify, Intel, Deloitte +7 Solve
Valid AnagramHashing Easy Arrays & Hashing Netflix, Databricks, Bloomberg +13 Solve
Median of Two Sorted ArraysBinary Search on Partition Hard Binary Search Google, Amazon, Microsoft +17 Solve
Valid PalindromeTwo Pointer Easy Arrays & Hashing Microsoft, Apple, Bloomberg +7 Solve
Subarray Sum Equals KPrefix Sum Strategy Medium Arrays & Hashing Google, Microsoft, Meta +15 Solve
Reverse IntegerMath / Number Theory Medium Arrays & Hashing Bloomberg, Barclays, TCS +4 Solve
Remove Duplicates from Sorted ArrayTwo Pointer Easy Arrays & Hashing Microsoft, Bloomberg, Cisco +8 Solve
Merge Sorted ArrayTwo Pointer Easy Arrays & Hashing Meta, Apple, Nvidia +12 Solve
Kadane's Algorithm - SimpleKadane's Algorithm Medium Arrays & Hashing Microsoft, Apple, LinkedIn +29 Solve
First Missing PositiveIn-place Transformations Hard Arrays & Hashing Amazon, Microsoft, Netflix +15 Solve
Single NumberMissing / Repeated Numbers Easy Bit Manipulation Airbnb, Bloomberg, Palantir +6 Solve
Climbing Stairs1D DP Easy Dynamic Programming Bloomberg, Intuit, Qualcomm +8 Solve
Max Consecutive OnesSliding Window · Variable Easy Arrays & Hashing Deloitte, Wipro, Accenture Solve
Majority ElementMoore's Voting Algorithm Easy Arrays & Hashing Bloomberg, Qualcomm, Deloitte +3 Solve
Find the Index of the First Occurrence in a StringString Matching (KMP) Easy Arrays & Hashing Wipro, Capgemini Solve
Jump GameGreedy Medium Arrays & Hashing Apple, DoorDash, Adobe +5 Solve
String CompressionTwo Pointer Medium Arrays & Hashing Microsoft, Stripe, Nvidia +10 Solve
Linked List CycleSlow Fast Pointers Easy Linked List Microsoft, Apple, Goldman Sachs +16 Solve
Next PermutationRight to Left Traversal Medium Arrays & Hashing Google, Amazon, Meta +15 Solve
Rotate ArrayDouble Reversal Trick Medium Arrays & Hashing Apple, Bloomberg, Samsung +8 Solve
Add Two NumbersDummy Node Pattern Medium Linked List Amazon, Microsoft, Meta +12 Solve
Roman to IntegerRight to Left Traversal Easy Arrays & Hashing Bloomberg, Oracle, JPMorgan Chase +8 Solve
Group AnagramsHashing Medium Arrays & Hashing Amazon, Microsoft, Meta +31 Solve
Binary SearchBasics Easy Binary Search Walmart Global Tech, Wipro, MakeMyTrip +1 Solve
Reverse StringTwo Pointer Easy Arrays & Hashing Samsung, Qualcomm, Intel +3 Solve
Minimum Absolute DifferenceGreedy Easy Arrays & Hashing JPMorgan Chase, PayPal, Walmart Global Tech Solve
Rotting OrangesMulti source BFS Medium Graphs Amazon, Microsoft, Databricks +17 Solve
Palindromic SubstringsStrings Medium Dynamic Programming Salesforce, Intuit, HCLTech Solve
3SumTwo Sum Medium Arrays & Hashing Google, Microsoft, Meta +31 Solve
Longest Consecutive SequenceHash Set Lookup Medium Arrays & Hashing Google, Bloomberg, Spotify +17 Solve
Boats to Save PeopleTwo Pointer Medium Arrays & Hashing Razorpay Solve
Also reported, being added to AlgoRung (4)

Third Maximum Number · Find the Highest Altitude · Sort Vowels in a String · Consecutive Numbers Sum

Questions people ask

What coding questions does Cognizant ask most?

Two Sum, Palindrome Number, Longest Substring Without Repeating Characters, Longest Palindromic Substring, Move Zeroes, Valid Parentheses, Best Time to Buy and Sell Stock, Fibonacci Number.

Which topics come up in Cognizant coding rounds?

arrays, strings, math, two pointers, hashing, stack.

How hard are Cognizant coding questions?

Of the reported questions, 20 are easy, 16 medium and 2 hard. A 45 to 60 minute live interview where you solve one or two data-structures-and-algorithms problems while explaining your thinking. Interviewers score problem solving, code quality, testing and communication.