Top 150 Coding Questions Asked in Service-Based Company Exams (2023–2025)
Posted on: Thu Jun 19 2025
Here is a list of 150 actual questions from placement and technical rounds carried out by leading service-based companies such as TCS, Infosys, Wipro, Accenture, Capgemini, Cognizant, HCL, and IBM. The questions are perfect to practice logic, data structures, and algorithms in order to enhance your placement performance.
Basic Level (1–50)
- Reverse a string. (TCS - 2023)
- Number is palindrome. (Infosys - 2024)
- Factorial recursively. (Wipro - 2023)
- Missing number in array. (Capgemini - 2024)
- Check anagram of strings. (Accenture - 2024)
- Bubble sort. (Infosys - 2023)
- Binary to decimal. (TCS - 2024)
- Print Fibonacci series. (Wipro - 2024)
- Second largest in array. (Capgemini - 2023)
- Count vowels in string. (Accenture - 2023)
- Check prime number. (Infosys - 2025)
- Check Armstrong number. (TCS - 2023)
- GCD of two numbers. (Wipro - 2023)
- Power function without library. (Capgemini - 2024)
- Reverse singly linked list. (Accenture - 2024)
- Binary search. (Infosys - 2024)
- Detect loop in linked list. (TCS - 2025)
- Longest substring without repeating characters. (Wipro - 2024)
- Check power of 2. (Capgemini - 2023)
- Merge two sorted arrays. (Accenture - 2023)
- Find LCM. (Infosys - 2023)
- Stack using two queues. (TCS - 2024)
- Valid palindrome excluding symbols. (Wipro - 2023)
- Count occurrence of elements. (Capgemini - 2025)
- String to title case. (Accenture - 2025)
- Rotate array by k positions. (Infosys - 2024)
- Balanced parentheses validation. (TCS - 2023)
- Implement Queue using two stacks. (Wipro - 2024)
- Missing and repeating number. (Capgemini - 2024)
- Kadane's algorithm. (Accenture - 2024)
- Sort array of 0s, 1s, 2s. (Cognizant - 2024)
- Number of digits in an integer. (Infosys - 2024)
- Armstrong numbers in range. (Wipro - 2023)
- Array elements sum. (TCS - 2023)
- Factorial through loop. (Capgemini - 2025)
- Two numbers without temp swapping. (Accenture - 2024)
- Linear search. (Infosys - 2023)
- Add two matrices. (Wipro - 2024)
- Print prime numbers within a range. (HCL - 2024)
- Print pattern of stars. (TCS - 2023)
- Words in sentence count. (Infosys - 2024)
- Leap year check. (Wipro - 2023)
- Duplicates in array remove. (Capgemini - 2023)
- Remove white spaces from string. (Accenture - 2025)
- Sum of digits of a number. (IBM - 2025)
- Find median of array. (TCS - 2024)
- Count set bits in integer. (Infosys - 2024)
- Transpose of matrix. (Wipro - 2023)
- Calculate power with bitwise. (Capgemini - 2025)
- Merge two strings alternatively. (Accenture - 2023)
------------------
Intermediate Level (51–100)
- Next greater element. (TCS - 2023)
- Reverse the words in sentence. (Wipro - 2023)
- Find leaders in array. (Capgemini - 2024)
- Valid parenthesis with stack. (Infosys - 2024)
- Infix to postfix conversion. (Accenture - 2024)
- Evaluate postfix expression. (HCL - 2023)
- Intersection of two arrays. (TCS - 2023)
- Union of two arrays. (IBM - 2025)
- Find duplicate elements. (Wipro - 2024)
- Check for Armstrong in array. (Capgemini - 2025)
- Spiral print of matrix. (Accenture - 2023)
- Diagonal sum of matrix. (Infosys - 2024)
- Rearrange array in zigzag. (TCS - 2023)
- Longest common prefix. (Wipro - 2023)
- Sort string alphabetically. (Capgemini - 2024)
- Count uppercase/lowercase chars. (Infosys - 2025)
- Find max occurring character. (Accenture - 2025)
- Convert decimal to binary. (TCS - 2024)
- Convert binary to octal. (Wipro - 2023)
- Replace space with %20. (Capgemini - 2025)
- Zigzag traversal of binary tree. (Infosys - 2024)
- Validate Sudoku. (Accenture - 2024)
- Count islands in grid. (IBM - 2023)
- Reverse array in-place. (TCS - 2023)
- First non-repeating character. (Wipro - 2024)
- Subset sum problem. (Capgemini - 2023)
- Check palindrome linked list. (Infosys - 2023)
- Flatten a linked list. (Accenture - 2023)
- Detect cycle in graph. (HCL - 2023)
- Topological sort. (TCS - 2024)
- Print boundary of binary tree. (Wipro - 2023)
- Binary tree height. (Capgemini - 2025)
- Reverse stack recursively. (Infosys - 2025)
- Queue using linked list. (Accenture - 2025)
- LRU cache implementation. (TCS - 2023)
- Longest increasing subsequence. (Wipro - 2024)
- Count inversions in array. (Capgemini - 2025)
- Implement trie. (Infosys - 2024)
- Minimum coins to make amount. (Accenture - 2023)
- Word break problem. (IBM - 2025)
- Matrix rotation by 90 degrees. (TCS - 2024)
- Binary tree to DLL. (Wipro - 2024)
- Generate balanced parentheses. (Capgemini - 2025)
- Shortest path in matrix. (Accenture - 2025)
- N-th Fibonacci using DP. (Infosys - 2024)
- Bellman-Ford algorithm. (TCS - 2023)
- Floyd-Warshall algorithm. (Wipro - 2024)
- Dijkstra's algorithm. (Capgemini - 2024)
- Heap sort. (Infosys - 2025)
- Top K frequent elements. (Accenture - 2023)
---------------
Advanced Level (101–150)
- Maximum product subarray. (Wipro - 2024)
- Rotate linked list. (Capgemini - 2025)
- Detect intersection of linked lists. (TCS - 2023)
- Celebrity problem using stack. (Infosys - 2024)
- Count set bits using Brian Kernighan's algo. (Accenture - 2024)
- Maximum sum path in matrix. (HCL - 2025)
- Implement max heap. (TCS - 2024)
- Largest rectangle in histogram. (Wipro - 2023)
- Trapping rain water problem. (Capgemini - 2025)
- Sudoku solver. (Accenture - 2025)
- Snake and ladder game simulation. (Infosys - 2024)
- Find median of data stream. (TCS - 2023)
- Sliding window maximum. (Wipro - 2024)
- Serialize and deserialize binary tree. (Capgemini - 2023)
- Jump game. (Infosys - 2025)
- Count number of ways to climb stairs. (Accenture - 2025)
- Wildcard pattern matching. (TCS - 2024)
- Regex matching. (Wipro - 2023)
- N-Queens problem. (Capgemini - 2025)
- Count number of BSTs. (Infosys - 2023)
- Implement segment tree. (Accenture - 2025)
- Lowest common ancestor in binary tree. (HCL - 2024)
- Inorder successor in BST. (TCS - 2024)
- Interleave K sorted lists. (Wipro - 2024)
- Find peak element. (Capgemini - 2023)
- Diameter of binary tree. (Infosys - 2024)
- Longest palindromic substring. (Accenture - 2023)
- Count distinct subsequences. (IBM - 2025)
- Matrix chain multiplication. (TCS - 2023)
- Minimum window substring. (Wipro - 2024)
- Edit distance. (Capgemini - 2025)
- Word ladder. (Infosys - 2024)
- Evaluation of expression tree. (Accenture - 2024)
- Bit manipulation problems. (TCS - 2024)
- Disjoint set (Union Find). (Wipro - 2023)
- Max path sum in binary tree. (Capgemini - 2023)
- Job scheduling with deadlines. (Infosys - 2025)
- Course schedule (topological). (Accenture - 2025)
- Number of smaller elements to right. (TCS - 2024)
- Burst balloons problem. (Wipro - 2023)
- Max points from cards. (Capgemini - 2024)
- Find centroid of a tree. (Infosys - 2024)
- Inversion count using merge sort. (Accenture - 2023)
- Convert BST to greater sum tree. (TCS - 2023)
- Palindrome partitioning. (Wipro - 2024)
- Decode ways (DP). (Capgemini - 2025)
- Longest valid parentheses. (Infosys - 2024)
- Distinct paths in a matrix. (Accenture - 2025)
- Count ways to make change. (TCS - 2024)
- Largest subarray with 0 sum. (Wipro - 2023)