Tcs logo TC
Verified Company Vault 30d Active

Tcs DSA Interview Questions

216 curated coding interview questions directly asked in Tcs technical rounds, sorted by frequency with recency and difficulty diagnostics.

216 Total Questions
95 (44%) Easy Problems
100 (46%) Medium Problems
21 (10%) Hard Problems
🔥 Most Tested Topics:
Arrays (78)Core DSA (68)Strings (34)Trees (15)Linked List (13)
📂 Sourced Datasets:
Last 30 daysLast 3 monthsLast 6 monthsAll questionsOlder than 6 months

Showing top 200 of 216 questions. View all 216 in the interactive tracker.

Showing 200 of 200 displayed
IDProblemDifficultyTopicPatternAcceptanceFrequencyRecency
766Toeplitz MatrixEasyArraysSorting / Prefix / Scan69.7%100.0%30d
53Maximum SubarrayMediumArraysSorting / Prefix / Scan53.3%100.0%30d
54Spiral MatrixMediumArraysSorting / Prefix / Scan56.8%100.0%30d
283Move ZeroesEasyCore DSATwo Pointers63.8%100.0%3m
152Maximum Product SubarrayMediumArraysSorting / Prefix / Scan36.4%100.0%3m
5Longest Palindromic SubstringMediumStrings; TreesHashing / Sliding Window; DFS / BFS37.8%100.0%6m
2993Friday Purchases IMediumCore DSAImplementation / Reasoning81.1%100.0%all
1Two SumEasyArraysSorting / Prefix / Scan; Two Pointers57.5%87.5%3m
28Find the Index of the First Occurrence in a StringEasyStringsHashing / Sliding Window46.7%75.0%3m
14Longest Common PrefixEasyCore DSAImplementation / Reasoning47.6%75.0%3m
242Valid AnagramEasyStringsHashing / Sliding Window68.1%75.0%3m
621Task SchedulerMediumGreedyGreedy63.1%75.0%3m
118Pascal's TriangleEasyCore DSAImplementation / Reasoning78.9%75.0%3m
496Next Greater Element IEasyStack / QueueMonotonic Stack / Simulation76.1%75.0%3m
153Find Minimum in Rotated Sorted ArrayMediumArrays; Binary SearchSorting / Prefix / Scan; Binary Search54.7%75.0%3m
26Remove Duplicates from Sorted ArrayEasyArraysSorting / Prefix / Scan; Two Pointers62.8%75.0%3m
3Longest Substring Without Repeating CharactersMediumStrings; TreesHashing / Sliding Window; DFS / BFS; Sliding Window39.1%75.0%3m
9Palindrome NumberEasyStringsHashing / Sliding Window60.6%75.0%6m
312Burst BalloonsHardCore DSAImplementation / Reasoning63.5%75.0%6m
125Valid PalindromeEasyStringsHashing / Sliding Window53.3%75.0%6m
560Subarray Sum Equals KMediumArraysSorting / Prefix / Scan47.3%75.0%6m
2Add Two NumbersMediumCore DSAImplementation / Reasoning48.5%75.0%6m
344Reverse StringEasyStringsHashing / Sliding Window80.8%75.0%6m
189Rotate ArrayMediumArraysSorting / Prefix / Scan44.9%75.0%6m
540Single Element in a Sorted ArrayMediumArraysSorting / Prefix / Scan59.3%75.0%6m
88Merge Sorted ArrayEasyArraysSorting / Prefix / Scan54.9%75.0%6m
75Sort ColorsMediumArraysSorting / Prefix / Scan69.6%75.0%6m
4Median of Two Sorted ArraysHardArrays; HeapSorting / Prefix / Scan; Priority Queue46.6%62.5%6m
33Search in Rotated Sorted ArrayMediumArrays; Binary SearchSorting / Prefix / Scan; Binary Search44.9%62.5%6m
8String to Integer (atoi)MediumStringsHashing / Sliding Window21.0%62.5%6m
153SumMediumArraysSorting / Prefix / Scan39.1%62.5%6m
977Squares of a Sorted ArrayEasyArraysSorting / Prefix / Scan73.8%62.5%6m
516Longest Palindromic SubsequenceMediumCore DSAImplementation / Reasoning65.4%62.5%6m
182Duplicate EmailsEasyArraysSorting / Prefix / Scan73.8%62.5%6m
136Single NumberEasyCore DSAImplementation / Reasoning77.7%62.5%6m
17Letter Combinations of a Phone NumberMediumStrings; BacktrackingHashing / Sliding Window; Backtracking66.1%62.5%6m
167Two Sum II - Input Array Is SortedMediumArraysSorting / Prefix / Scan; Two Pointers65.1%62.5%6m
1823Find the Winner of the Circular GameMediumCore DSAImplementation / Reasoning82.2%62.5%6m
176Second Highest SalaryMediumCore DSAImplementation / Reasoning47.0%62.5%6m
11Container With Most WaterMediumCore DSATwo Pointers60.0%62.5%6m
238Product of Array Except SelfMediumArraysSorting / Prefix / Scan68.9%62.5%6m
27Remove ElementEasyCore DSAImplementation / Reasoning61.8%62.5%6m
90Subsets IIMediumBacktrackingBacktracking61.3%62.5%6m
1021Remove Outermost ParenthesesEasyStringsHashing / Sliding Window87.1%62.5%6m
1581Customer Who Visited but Did Not Make Any TransactionsEasyCore DSAImplementation / Reasoning67.7%62.5%6m
181Employees Earning More Than Their ManagersEasyCore DSAImplementation / Reasoning73.2%62.5%6m
34Find First and Last Position of Element in Sorted ArrayMediumArraysSorting / Prefix / Scan48.9%62.5%6m
198House RobberMediumDynamic ProgrammingState Transition53.2%62.5%6m
121Best Time to Buy and Sell StockEasyCore DSAImplementation / Reasoning56.8%62.5%6m
20Valid ParenthesesEasyStringsHashing / Sliding Window44.2%62.5%all
169Majority ElementEasyCore DSAImplementation / Reasoning66.3%62.5%all
2423Remove Letter To Equalize FrequencyEasyStringsHashing / Sliding Window19.4%62.5%all
2520Count the Digits That Divide a NumberEasyCore DSAImplementation / Reasoning85.9%62.5%all
1800Maximum Ascending Subarray SumEasyArraysSorting / Prefix / Scan66.3%62.5%all
7Reverse IntegerMediumCore DSAImplementation / Reasoning31.9%50.0%all
13Roman to IntegerEasyStringsHashing / Sliding Window66.6%50.0%all
42Trapping Rain WaterHardCore DSATwo Pointers67.4%50.0%all
50Pow(x, n)MediumCore DSAImplementation / Reasoning38.7%50.0%all
55Jump GameMediumGreedyGreedy40.9%50.0%all
62Unique PathsMediumCore DSAImplementation / Reasoning66.8%50.0%all
66Plus OneEasyCore DSAImplementation / Reasoning50.0%50.0%all
70Climbing StairsEasyDynamic ProgrammingState Transition54.1%50.0%all
217Contains DuplicateEasyArraysSorting / Prefix / Scan64.4%50.0%all
268Missing NumberEasyArraysSorting / Prefix / Scan72.0%50.0%all
67Add BinaryEasyCore DSAImplementation / Reasoning58.1%50.0%all
2481Minimum Cuts to Divide a CircleEasyArraysSorting / Prefix / Scan56.2%50.0%all
898Bitwise ORs of SubarraysMediumArraysSorting / Prefix / Scan56.9%50.0%all
509Fibonacci NumberEasyCore DSAImplementation / Reasoning74.1%50.0%all
3065Minimum Operations to Exceed Threshold Value IEasyArraysSorting / Prefix / Scan86.8%50.0%all
3066Minimum Operations to Exceed Threshold Value IIMediumArraysSorting / Prefix / Scan45.8%50.0%all
1745Palindrome Partitioning IVHardStrings; Dynamic ProgrammingHashing / Sliding Window; State Transition45.5%50.0%all
1752Check if Array Is Sorted and RotatedEasyArrays; Binary SearchSorting / Prefix / Scan; Binary Search57.3%50.0%all
51N-QueensHardBacktrackingBacktracking75.5%50.0%all
219Contains Duplicate IIEasyArraysSorting / Prefix / Scan51.3%50.0%all
3417Zigzag Grid Traversal With SkipEasyCore DSAImplementation / Reasoning65.3%50.0%all
56Merge IntervalsMediumArraysSorting / Prefix / Scan51.8%50.0%all
184SumMediumArraysSorting / Prefix / Scan40.6%37.5%all
21Merge Two Sorted ListsEasyArrays; Linked ListSorting / Prefix / Scan; Two Pointers68.3%37.5%all
22Generate ParenthesesMediumStringsHashing / Sliding Window78.7%37.5%all
31Next PermutationMediumBacktrackingBacktracking45.3%37.5%all
58Length of Last WordEasyStringsHashing / Sliding Window58.8%37.5%all
73Set Matrix ZeroesMediumArraysSorting / Prefix / Scan62.9%37.5%all
69Sqrt(x)EasyBinary SearchBinary Search41.8%37.5%all
78SubsetsMediumBacktrackingBacktracking82.3%37.5%all
122Best Time to Buy and Sell Stock IIMediumCore DSAImplementation / Reasoning71.1%37.5%all
128Longest Consecutive SequenceMediumCore DSAImplementation / Reasoning47.1%37.5%all
151Reverse Words in a StringMediumStringsHashing / Sliding Window56.4%37.5%all
179Largest NumberMediumCore DSAImplementation / Reasoning43.1%37.5%all
185Department Top Three SalariesHardCore DSAImplementation / Reasoning60.5%37.5%all
202Happy NumberEasyCore DSAImplementation / Reasoning59.7%37.5%all
204Count PrimesMediumCore DSAImplementation / Reasoning36.1%37.5%all
239Sliding Window MaximumHardArraysSorting / Prefix / Scan; Sliding Window48.8%37.5%all
387First Unique Character in a StringEasyStringsHashing / Sliding Window65.5%37.5%all
412Fizz BuzzEasyCore DSAImplementation / Reasoning75.5%37.5%all
532K-diff Pairs in an ArrayMediumArraysSorting / Prefix / Scan45.9%37.5%all
584Find Customer RefereeEasyCore DSAImplementation / Reasoning72.9%37.5%all
1148Article Views IEasyCore DSAImplementation / Reasoning76.6%37.5%all
912Sort an ArrayMediumArraysSorting / Prefix / Scan55.9%37.5%all
543Diameter of Binary TreeEasyTreesDFS / BFS65.5%37.5%all
287Find the Duplicate NumberMediumArraysSorting / Prefix / Scan64.3%37.5%all
35Search Insert PositionEasyBinary SearchBinary Search51.3%37.5%all
1757Recyclable and Low Fat ProductsEasyArraysSorting / Prefix / Scan88.6%37.5%all
85Maximal RectangleHardCore DSAImplementation / Reasoning58.8%37.5%all
485Max Consecutive OnesEasyCore DSAImplementation / Reasoning65.2%37.5%all
416Partition Equal Subset SumMediumArrays; Dynamic ProgrammingSorting / Prefix / Scan; State Transition49.5%37.5%all
1075Project Employees IEasyCore DSAImplementation / Reasoning66.8%37.5%all
805Split Array With Same AverageHardArraysSorting / Prefix / Scan27.0%37.5%all
2006Count Number of Pairs With Absolute Difference KEasyCore DSAImplementation / Reasoning85.4%37.5%all
49Group AnagramsMediumStringsHashing / Sliding Window72.6%37.5%all
1512Number of Good PairsEasyCore DSAImplementation / Reasoning89.8%37.5%all
45Jump Game IIMediumGreedyGreedy42.9%37.5%all
124Binary Tree Maximum Path SumHardArrays; TreesSorting / Prefix / Scan; DFS / BFS42.3%37.5%all
23Merge k Sorted ListsHardArrays; Linked List; HeapSorting / Prefix / Scan; Two Pointers; Priority Queue59.6%37.5%all
141Linked List CycleEasyLinked ListTwo Pointers54.3%37.5%all
19Remove Nth Node From End of ListMediumTrees; Linked ListDFS / BFS; Two Pointers51.6%37.5%all
956Tallest BillboardHardCore DSAImplementation / Reasoning51.9%37.5%all
263Ugly NumberEasyCore DSAImplementation / Reasoning43.5%37.5%all
628Maximum Product of Three NumbersEasyArraysSorting / Prefix / Scan45.9%37.5%all
155Min StackMediumStack / QueueMonotonic Stack / Simulation58.2%37.5%all
875Koko Eating BananasMediumBinary SearchBinary Search50.0%37.5%all
876Middle of the Linked ListEasyLinked ListTwo Pointers81.8%37.5%all
1125Smallest Sufficient TeamHardCore DSAImplementation / Reasoning55.6%37.5%all
462Minimum Moves to Equal Array Elements IIMediumArraysSorting / Prefix / Scan61.9%37.5%all
297Serialize and Deserialize Binary TreeHardTrees; DesignDFS / BFS; Data Structure Design60.8%37.5%all
146LRU CacheMediumDesignData Structure Design47.4%37.5%all
643Maximum Average Subarray IEasyArraysSorting / Prefix / Scan47.8%37.5%all
2095Delete the Middle Node of a Linked ListMediumTrees; Linked ListDFS / BFS; Two Pointers59.6%37.5%all
414Third Maximum NumberEasyArraysSorting / Prefix / Scan39.4%37.5%all
41First Missing PositiveHardArraysSorting / Prefix / Scan42.9%37.5%all
2099Find Subsequence of Length K With the Largest SumEasyArraysSorting / Prefix / Scan57.4%37.5%all
81Search in Rotated Sorted Array IIMediumArrays; Binary SearchSorting / Prefix / Scan; Binary Search40.1%37.5%all
1068Product Sales Analysis IEasyArraysSorting / Prefix / Scan85.8%37.5%all
1493Longest Subarray of 1's After Deleting One ElementMediumArraysSorting / Prefix / Scan71.2%37.5%all
1518Water BottlesEasyCore DSAImplementation / Reasoning72.6%37.5%all
455Assign CookiesEasyCore DSAImplementation / Reasoning55.0%37.5%all
303Range Sum Query - ImmutableEasyArraysSorting / Prefix / Scan72.2%37.5%all
80Remove Duplicates from Sorted Array IIMediumArraysSorting / Prefix / Scan; Two Pointers64.7%25.0%all
84Largest Rectangle in HistogramHardCore DSAImplementation / Reasoning49.9%25.0%all
206Reverse Linked ListEasyLinked ListTwo Pointers80.6%25.0%all
231Power of TwoEasyCore DSAImplementation / Reasoning50.1%25.0%all
349Intersection of Two ArraysEasyArraysSorting / Prefix / Scan77.8%25.0%all
577Employee BonusEasyCore DSAImplementation / Reasoning77.4%25.0%all
595Big CountriesEasyTreesDFS / BFS68.5%25.0%all
704Binary SearchEasyBinary SearchBinary Search60.9%25.0%all
852Peak Index in a Mountain ArrayMediumArrays; Binary SearchSorting / Prefix / Scan; Binary Search66.8%25.0%all
1636Sort Array by Increasing FrequencyEasyArraysSorting / Prefix / Scan80.8%25.0%all
3190Find Minimum Operations to Make All Elements Divisible by ThreeEasyArraysSorting / Prefix / Scan90.8%25.0%all
63Unique Paths IIMediumCore DSAImplementation / Reasoning44.5%25.0%all
1492The kth Factor of nMediumHeapPriority Queue70.4%25.0%all
273Integer to English WordsHardStringsHashing / Sliding Window35.0%25.0%all
196Delete Duplicate EmailsEasyArraysSorting / Prefix / Scan66.0%25.0%all
162Find Peak ElementMediumBinary SearchBinary Search47.0%25.0%all
1025Divisor GameEasyCore DSAImplementation / Reasoning71.9%25.0%all
670Maximum SwapMediumArraysSorting / Prefix / Scan52.0%25.0%all
229Majority Element IIMediumCore DSAImplementation / Reasoning56.2%25.0%all
3163String Compression IIIMediumStringsHashing / Sliding Window67.1%25.0%all
1455Check If a Word Occurs As a Prefix of Any Word in a SentenceEasyStringsHashing / Sliding Window68.8%25.0%all
2461Maximum Sum of Distinct Subarrays With Length KMediumArraysSorting / Prefix / Scan43.0%25.0%all
374Guess Number Higher or LowerEasyCore DSAImplementation / Reasoning57.6%25.0%all
1480Running Sum of 1d ArrayEasyArraysSorting / Prefix / Scan86.9%25.0%all
1368Minimum Cost to Make at Least One Valid Path in a GridHardArrays; StringsSorting / Prefix / Scan; Hashing / Sliding Window71.0%25.0%all
1378Replace Employee ID With The Unique IdentifierEasyCore DSAImplementation / Reasoning83.5%25.0%all
567Permutation in StringMediumStrings; BacktrackingHashing / Sliding Window; Sliding Window; Backtracking48.9%25.0%all
1497Check If Array Pairs Are Divisible by kMediumArraysSorting / Prefix / Scan46.2%25.0%all
48Rotate ImageMediumArraysSorting / Prefix / Scan80.1%25.0%all
658Find K Closest ElementsMediumCore DSAImplementation / Reasoning49.7%25.0%all
442Find All Duplicates in an ArrayMediumArraysSorting / Prefix / Scan76.9%25.0%all
2563Count the Number of Fair PairsMediumCore DSAImplementation / Reasoning52.7%25.0%all
2703Return Length of Arguments PassedEasyCore DSAImplementation / Reasoning94.5%25.0%all
1910Remove All Occurrences of a SubstringMediumStrings; TreesHashing / Sliding Window; DFS / BFS78.5%25.0%all
459Repeated Substring PatternEasyStrings; TreesHashing / Sliding Window; DFS / BFS48.2%25.0%all
3330Find the Original Typed String IEasyStringsHashing / Sliding Window72.0%25.0%all
164Maximum GapMediumArraysSorting / Prefix / Scan52.1%25.0%all
1751Maximum Number of Events That Can Be Attended IIHardArraysSorting / Prefix / Scan63.5%25.0%all
328Odd Even Linked ListMediumLinked ListTwo Pointers62.5%25.0%all
109Convert Sorted List to Binary Search TreeMediumArrays; Trees; Linked List; Binary SearchSorting / Prefix / Scan; DFS / BFS; Two Pointers; Binary Search66.6%25.0%all
713Subarray Product Less Than KMediumArraysSorting / Prefix / Scan54.3%25.0%all
3136Valid WordEasyStringsHashing / Sliding Window50.9%25.0%all
1614Maximum Nesting Depth of the ParenthesesEasyArrays; StringsSorting / Prefix / Scan; Hashing / Sliding Window84.9%25.0%all
142Linked List Cycle IIMediumLinked ListTwo Pointers57.9%25.0%all
495Teemo AttackingEasyCore DSAImplementation / Reasoning57.7%25.0%all
979Distribute Coins in Binary TreeMediumTrees; Dynamic ProgrammingDFS / BFS; State Transition77.3%25.0%all
209Minimum Size Subarray SumMediumArraysSorting / Prefix / Scan51.7%25.0%all
94Binary Tree Inorder TraversalEasyTreesDFS / BFS80.1%25.0%all
1015Smallest Integer Divisible by KMediumCore DSAImplementation / Reasoning54.3%25.0%all
184Department Highest SalaryMediumCore DSAImplementation / Reasoning58.1%25.0%all
1365How Many Numbers Are Smaller Than the Current NumberEasyCore DSAImplementation / Reasoning87.4%25.0%all
143Reorder ListMediumLinked ListTwo Pointers65.3%25.0%all
319Bulb SwitcherMediumCore DSAImplementation / Reasoning55.9%25.0%all
10Regular Expression MatchingHardCore DSAImplementation / Reasoning31.0%25.0%all
570Managers with at Least 5 Direct ReportsMediumCore DSAImplementation / Reasoning49.0%25.0%all
350Intersection of Two Arrays IIEasyArraysSorting / Prefix / Scan59.9%25.0%all
2054Two Best Non-Overlapping EventsMediumGreedyGreedy64.0%25.0%all
994Rotting OrangesMediumCore DSAImplementation / Reasoning58.7%25.0%all
435Non-overlapping IntervalsMediumArrays; GreedySorting / Prefix / Scan; Greedy57.1%25.0%all
83Remove Duplicates from Sorted ListEasyArrays; Linked ListSorting / Prefix / Scan; Two Pointers56.7%25.0%all
3714Longest Balanced Substring IIMediumStrings; TreesHashing / Sliding Window; DFS / BFS41.9%25.0%all
38Count and SayMediumCore DSAImplementation / Reasoning62.9%25.0%all
12Integer to RomanMediumStringsHashing / Sliding Window71.0%25.0%all
200Number of IslandsMediumGraphsBFS / DFS / Topological Sort64.4%25.0%all