250+ Coding Interview Questions Asked in Service-Based Companies (with Company Tags & Links)

Posted on: Sat Jun 28 2025

  1. Reverse a string – Asked in: Infosys

  2. Check if a string is a palindrome – Asked in: Capgemini

  3. Find the factorial of a number – Asked in: Wipro

  4. Find the largest number in an array – Asked in: TCS

  5. Find the smallest number in an array – Asked in: Cognizant

  6. Calculate the sum of array elements – Asked in: Infosys

  7. Count even and odd numbers in an array – Asked in: Accenture

  8. Count vowels and consonants in a string – Asked in: IBM

  9. Swap two numbers – Asked in: TCS

  10. Print Fibonacci series – Asked in: Infosys

  11. Check if a number is prime – Asked in: Wipro

  12. Find GCD of two numbers – Asked in: TCS

  13. Find LCM of two numbers – Asked in: Infosys

  14. Check Armstrong number – Asked in: Capgemini

  15. Check Perfect number – Asked in: Cognizant

  16. Reverse a number – Asked in: IBM

  17. Count digits in a number – Asked in: Accenture

  18. Print prime numbers in a range – Asked in: TCS

  19. Print multiplication table – Asked in: Infosys

  20. Find power of a number – Asked in: Wipro

  21. Convert binary to decimal – Asked in: Capgemini

  22. Convert decimal to binary – Asked in: Cognizant

  23. Remove duplicates from an array – Asked in: Infosys

  24. Find frequency of elements in an array – Asked in: Accenture

  25. Sort array using bubble sort – Asked in: TCS

  26. Sort array using selection sort – Asked in: Wipro

  27. Find second largest element – Asked in: IBM

  28. Find second smallest element – Asked in: Capgemini

  29. Merge two arrays – Asked in: Infosys

  30. Find missing number in array (1 to N) – Asked in: TCS

  31. Count occurrences of a character in string – Asked in: Wipro

  32. Capitalize first letter of each word in string – Asked in: Accenture

  33. Remove all white spaces from string – Asked in: Infosys

  34. Replace character in string – Asked in: Cognizant

  35. Remove special characters from string – Asked in: TCS

  36. Compare two strings – Asked in: Wipro

  37. Find length of string without using length() – Asked in: Capgemini

  38. Convert lowercase to uppercase – Asked in: Infosys

  39. Convert string to integer – Asked in: IBM

  40. Convert integer to string – Asked in: Accenture

  41. Find ASCII value of character – Asked in: TCS

  42. Check if strings are anagrams – Asked in: Capgemini

  43. Count number of words in string – Asked in: Infosys

  44. Remove duplicates from string – Asked in: Wipro

  45. Check if array is sorted – Asked in: Cognizant

  46. Implement linear search – Asked in: TCS

  47. Implement binary search – Asked in: Infosys

  48. Find intersection of two arrays – Asked in: Wipro

  49. Find union of two arrays – Asked in: Accenture

  50. Find sum of digits of number – Asked in: Capgemini

...

  1. Find common elements in three sorted arrays – Asked in: Infosys

  2. Check for pair with given sum in array – Asked in: Capgemini

  3. Find majority element in array – Asked in: TCS

  4. Kadane’s Algorithm – Max subarray sum – Asked in: Wipro

  5. Check if array contains duplicate – Asked in: Infosys

  6. Check if two strings are isomorphic – Asked in: IBM

  7. Longest common prefix – Asked in: Accenture

  8. Longest substring without repeating characters – Asked in: TCS

  9. Group anagrams – Asked in: Wipro

  10. Check if linked list is palindrome – Asked in: Infosys

  11. Find middle of linked list – Asked in: Capgemini

  12. Detect loop in linked list – Asked in: TCS

  13. Remove Nth node from end – Asked in: Cognizant

  14. Merge two sorted linked lists – Asked in: Wipro

  15. Reverse a linked list – Asked in: Infosys

  16. Find intersection of two linked lists – Asked in: Accenture

  17. Add two numbers as linked list – Asked in: IBM

  18. Remove duplicates from sorted list – Asked in: Capgemini

  19. Delete node in a linked list – Asked in: TCS

  20. Odd even linked list – Asked in: Wipro

  21. Detect and remove loop in linked list – Asked in: Infosys

  22. Implement stack using arrays – Asked in: Capgemini

  23. Implement queue using arrays – Asked in: TCS

  24. Implement circular queue – Asked in: Cognizant

  25. Infix to postfix conversion – Asked in: Wipro

  26. Evaluate postfix expression – Asked in: Infosys

  27. Next greater element – Asked in: Accenture

  28. Balanced parentheses – Asked in: IBM

  29. Stock span problem – Asked in: Capgemini

  30. LRU Cache implementation – Asked in: TCS

  31. Insert interval – Asked in: Wipro

  32. Merge intervals – Asked in: Infosys

  33. Minimum platforms required – Asked in: Capgemini

  34. Job scheduling problem – Asked in: TCS

  35. N meeting in one room – Asked in: Wipro

  36. Activity selection problem – Asked in: Infosys

  37. Fractional knapsack problem – Asked in: IBM

  38. 0/1 Knapsack problem – Asked in: Accenture

  39. Longest common subsequence – Asked in: TCS

  40. Longest palindromic subsequence – Asked in: Capgemini

  41. Coin change problem – Asked in: Infosys

  42. Rod cutting problem – Asked in: Cognizant

  43. Minimum number of coins – Asked in: Accenture

  44. Subset sum problem – Asked in: Wipro

  45. Word break problem – Asked in: IBM

  46. Longest increasing subsequence – Asked in: TCS

  47. Maximum product subarray – Asked in: Infosys

  48. Edit distance – Asked in: Capgemini

  49. Boolean parenthesization problem – Asked in: Wipro

  50. Palindrome partitioning – Asked in: TCS

...

  1. Two Sum Problem – Asked in: TCS

  2. Move zeros to end of array – Asked in: Wipro

  3. Rotate array by K elements – Asked in: Infosys

  4. Check if subarray with 0 sum exists – Asked in: Capgemini

  5. Find longest subarray with given sum – Asked in: Cognizant

  6. Maximum sum increasing subsequence – Asked in: Infosys

  7. Trapping Rain Water – Asked in: TCS

  8. Minimum jumps to reach end – Asked in: Wipro

  9. Chocolate Distribution Problem – Asked in: Capgemini

  10. Activity Selection (Greedy) – Asked in: Accenture

  11. Find missing and repeating number – Asked in: TCS

  12. Find duplicate number (Floyd's Cycle) – Asked in: Infosys

  13. Set Matrix Zeroes – Asked in: Wipro

  14. Spiral Matrix – Asked in: Capgemini

  15. Search in a sorted 2D matrix – Asked in: IBM

  16. Find peak element – Asked in: Accenture

  17. Kth smallest element in array – Asked in: TCS

  18. Kth largest element using heap – Asked in: Infosys

  19. Sliding window maximum – Asked in: Wipro

  20. First negative integer in window – Asked in: Capgemini

  21. Check if brackets are balanced – Asked in: Infosys

  22. Implement queue using stack – Asked in: IBM

  23. Implement stack using queue – Asked in: Accenture

  24. LRU Cache – Asked in: Capgemini

  25. LFU Cache – Asked in: Wipro

  26. Flatten a linked list – Asked in: TCS

  27. Clone a linked list with random pointer – Asked in: Infosys

  28. Sort a stack – Asked in: Capgemini

  29. Delete middle of a stack – Asked in: Wipro

  30. Insert at bottom of stack – Asked in: TCS

  31. Check for balanced tree – Asked in: Infosys

  32. Diameter of binary tree – Asked in: Capgemini

  33. Invert binary tree – Asked in: IBM

  34. Zigzag traversal of binary tree – Asked in: Accenture

  35. Boundary traversal of binary tree – Asked in: TCS

  36. Top view of binary tree – Asked in: Infosys

  37. Bottom view of binary tree – Asked in: Capgemini

  38. Vertical order traversal – Asked in: Wipro

  39. Symmetric tree – Asked in: Infosys

  40. Binary tree from inorder & preorder – Asked in: IBM

  41. Lowest common ancestor in binary tree – Asked in: Capgemini

  42. Max depth of binary tree – Asked in: TCS

  43. Sum root to leaf numbers – Asked in: Infosys

  44. Path sum – Asked in: Wipro

  45. Binary tree level order traversal – Asked in: Accenture

  46. Convert binary tree to doubly linked list – Asked in: Capgemini

  47. Serialize and deserialize binary tree – Asked in: Infosys

  48. Check subtree of another tree – Asked in: TCS

  49. Construct tree from postorder and inorder – Asked in: Capgemini

  50. Flatten binary tree to linked list – Asked in: Wipro

  1. Find all duplicates in array – Asked in: Infosys

  2. Find first and last position of element – Asked in: TCS

  3. Count number of subarrays with sum k – Asked in: Capgemini

  4. Find pivot index – Asked in: Cognizant

  5. Max consecutive ones – Asked in: Wipro

  6. Missing number – Asked in: Accenture

  7. Min size subarray sum – Asked in: Infosys

  8. Find all numbers disappeared – Asked in: TCS

  9. Minimum operations to make array equal – Asked in: IBM

  10. Merge two sorted arrays – Asked in: Capgemini

  11. Check array is sorted and rotated – Asked in: Wipro

  12. Best time to buy and sell stock – Asked in: Infosys

  13. Subarray product less than k – Asked in: Accenture

  14. Find target indices after sorting – Asked in: TCS

  15. Rearrange array elements by sign – Asked in: Wipro

  16. Maximum average subarray I – Asked in: Capgemini

  17. Find kth positive missing number – Asked in: Infosys

  18. Number of good pairs – Asked in: Cognizant

  19. Intersection of two arrays – Asked in: IBM

  20. Relative sort array – Asked in: Capgemini

  21. Check if number is power of two – Asked in: Wipro

  22. Single number – Asked in: TCS

  23. Hamming weight – Asked in: Infosys

  24. Count set bits – Asked in: Accenture

  25. Find XOR of numbers from 1 to n – Asked in: IBM

  26. Sum of two integers without + - – Asked in: Capgemini

  27. Reverse bits – Asked in: Wipro

  28. Add binary – Asked in: Infosys

  29. Bitwise AND of numbers range – Asked in: TCS

  30. Find missing number using XOR – Asked in: Accenture

  31. Subsets – Asked in: Wipro

  32. Permutations – Asked in: Infosys

  33. Combination sum – Asked in: Capgemini

  34. Word search – Asked in: TCS

  35. N queens – Asked in: IBM

  36. Palindrome partitioning – Asked in: Accenture

  37. Letter case permutation – Asked in: Cognizant

  38. Generate parentheses – Asked in: Infosys

  39. Sudoku solver – Asked in: Wipro

  40. Restore IP addresses – Asked in: TCS

  41. Gray code – Asked in: Capgemini

  42. Combination sum II – Asked in: Infosys

  43. Combinations – Asked in: Wipro

  44. Subsets II – Asked in: Accenture

  45. Path sum II – Asked in: TCS

  46. Letter combinations of a phone number – Asked in: Capgemini

  47. Permutations II – Asked in: Infosys

  48. Word break – Asked in: Wipro

  49. Palindrome partitioning II – Asked in: IBM

  50. Minimum number of swaps to make string balanced – Asked in: Cognizant

...

  1. Validate Binary Search Tree – Asked in: Infosys

  2. Lowest Common Ancestor of a BST – Asked in: Wipro

  3. Binary Tree Inorder Traversal – Asked in: TCS

  4. Construct Binary Tree from Inorder and Preorder – Asked in: Capgemini

  5. Populating Next Right Pointers – Asked in: IBM

  6. Flatten a Multilevel Doubly Linked List – Asked in: Infosys

  7. Insert into a Binary Search Tree – Asked in: Cognizant

  8. Sum of Left Leaves – Asked in: Wipro

  9. Maximum Depth of N-ary Tree – Asked in: Accenture

  10. Convert Sorted Array to BST – Asked in: TCS

  11. Construct String from Binary Tree – Asked in: Infosys

  12. Average of Levels in Binary Tree – Asked in: Capgemini

  13. Binary Tree Tilt – Asked in: Wipro

  14. Path Sum III – Asked in: Cognizant

  15. Find Duplicate Subtrees – Asked in: Accenture

  16. Construct Binary Tree from String – Asked in: IBM

  17. Binary Tree Cameras – Asked in: TCS

  18. Binary Tree Coloring Game – Asked in: Infosys

  19. All Nodes Distance K in Binary Tree – Asked in: Capgemini

  20. Recover Binary Search Tree – Asked in: Wipro

  21. Boundary of Binary Tree – Asked in: Cognizant

  22. Binary Tree Right Side View – Asked in: Infosys

  23. Same Tree – Asked in: Capgemini

  24. Count Complete Tree Nodes – Asked in: TCS

  25. Binary Tree Paths – Asked in: IBM

  26. Sum of Nodes with Even-Valued Grandparent – Asked in: Accenture

  27. Longest ZigZag Path in Binary Tree – Asked in: Wipro

  28. Tree Diameter – Asked in: Infosys

  29. Count Good Nodes in Binary Tree – Asked in: Capgemini

  30. Binary Search Tree Iterator – Asked in: Cognizant

  31. Serialize and Deserialize BST – Asked in: IBM

  32. Delete Node in a BST – Asked in: Wipro

  33. Kth Smallest Element in BST – Asked in: Infosys

  34. Validate Stack Sequences – Asked in: Capgemini

  35. Check Completeness of a Binary Tree – Asked in: TCS

  36. Maximum Width of Binary Tree – Asked in: Accenture

  37. Find Largest Value in Each Tree Row – Asked in: Wipro

  38. Cousins in Binary Tree – Asked in: Infosys

  39. Vertical Order Traversal – Asked in: Cognizant

  40. Binary Tree Postorder Traversal – Asked in: Capgemini

  41. Sum of Root To Leaf Binary Numbers – Asked in: Wipro

  42. Delete Leaves with a Given Value – Asked in: Infosys

  43. Longest Univalue Path – Asked in: TCS

  44. Find Bottom Left Tree Value – Asked in: IBM

  45. Flip Equivalent Binary Trees – Asked in: Accenture

  46. All Elements in Two BSTs – Asked in: Cognizant

  47. Merge Two Binary Trees – Asked in: Capgemini

  48. Binary Tree Level Order Traversal II – Asked in: Wipro

  49. Path In Zigzag Labelled Binary Tree – Asked in: Infosys

  50. Sum of Distances in Tree – Asked in: TCS