0% found this document useful (0 votes)
25 views

Here are 200 important coding questions that are commonly asked in Capgemini

The document lists 200 important coding questions commonly asked in Capgemini's fresher coding exams, covering various topics such as arrays, strings, linked lists, trees, graphs, dynamic programming, stacks and queues, mathematical problems, bit manipulation, recursion, backtracking, and searching and sorting. Each category contains specific problems that test different coding skills and concepts. This comprehensive collection serves as a valuable resource for candidates preparing for technical interviews.

Uploaded by

jeet biswas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Here are 200 important coding questions that are commonly asked in Capgemini

The document lists 200 important coding questions commonly asked in Capgemini's fresher coding exams, covering various topics such as arrays, strings, linked lists, trees, graphs, dynamic programming, stacks and queues, mathematical problems, bit manipulation, recursion, backtracking, and searching and sorting. Each category contains specific problems that test different coding skills and concepts. This comprehensive collection serves as a valuable resource for candidates preparing for technical interviews.

Uploaded by

jeet biswas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Here are 200 important coding questions that are commonly asked in Capgemini's fresher coding

exams, based on previous years' patterns. These questions cover a wide range of topics, including
data structures, algorithms, problem-solving, dynamic programming, and object-oriented
programming.

Array Problems

1. Find the largest and smallest number in an array.

2. Reverse an array.

3. Find the "Kth" largest/smallest element in an array.

4. Find the missing number in an array of integers from 1 to n.

5. Find the duplicate number in an array of integers.

6. Merge two sorted arrays into a single sorted array.

7. Rotate an array by k positions to the right.

8. Find the maximum sum subarray (Kadane's Algorithm).

9. Find the maximum product subarray.

10. Find all pairs in an array whose sum is equal to a given number.

11. Find the intersection of two arrays.

12. Move all zeroes to the end of an array.

13. Find the common elements in three sorted arrays.

14. Sort an array of 0s, 1s, and 2s.

15. Rearrange an array such that the positive and negative numbers are placed alternately.

16. Find the contiguous subarray with a given sum.

17. Find the equilibrium index of an array.

18. Count the frequency of each element in an array.

19. Find the majority element in an array (Moore's Voting Algorithm).

20. Find the length of the longest consecutive sequence in an array.

String Problems

21. Reverse a string.

22. Check if two strings are anagrams of each other.

23. Find the first non-repeating character in a string.

24. Find all permutations of a given string.

25. Implement a function to check if a string is a palindrome.

26. Find the longest palindromic substring.


27. Implement a function to find the longest common prefix among an array of strings.

28. Check if one string is a rotation of another.

29. Convert a string to an integer (atoi function).

30. Find the longest substring without repeating characters.

31. Find the smallest window in a string containing all characters of another string.

32. Implement a basic string compression algorithm.

33. Remove all duplicates from a given string.

34. Implement strstr function (substring search).

35. Find the length of the longest valid parentheses substring.

36. Count the number of times a pattern appears in a given string.

37. Find the longest repeating subsequence in a string.

38. Reverse words in a given string.

39. Group anagrams from a given list of strings.

40. Check if a string is a valid shuffle of two other strings.

Linked List Problems

41. Reverse a linked list.

42. Detect and remove a loop in a linked list.

43. Find the middle of a linked list.

44. Merge two sorted linked lists.

45. Delete the Nth node from the end of a linked list.

46. Check if a linked list is a palindrome.

47. Remove duplicates from a sorted linked list.

48. Rotate a linked list.

49. Add two numbers represented by linked lists.

50. Flatten a multilevel doubly linked list.

51. Reverse a linked list in groups of given size.

52. Find the intersection point of two linked lists.

53. Clone a linked list with random pointers.

54. Swap nodes in pairs in a linked list.

55. Sort a linked list.

56. Split a circular linked list into two halves.


57. Remove every Kth node from a circular linked list.

58. Convert a sorted linked list to a balanced binary search tree.

59. Find the starting point of a loop in a linked list.

60. Reverse alternate nodes in a linked list.

Tree Problems

61. Implement a function for in-order, pre-order, and post-order traversal of a binary tree.

62. Find the height of a binary tree.

63. Check if two binary trees are identical.

64. Find the lowest common ancestor of two nodes in a binary tree.

65. Check if a binary tree is balanced.

66. Convert a binary tree into its mirror tree.

67. Print the nodes of a binary tree in zigzag order.

68. Find the diameter of a binary tree.

69. Check if a binary tree is a binary search tree (BST).

70. Serialize and deserialize a binary tree.

71. Print all root-to-leaf paths in a binary tree.

72. Find the maximum path sum in a binary tree.

73. Construct a binary tree from inorder and preorder traversals.

74. Convert a binary tree to a doubly linked list.

75. Find the distance between two nodes in a binary tree.

76. Count the number of leaf nodes in a binary tree.

77. Find the level of a node in a binary tree.

78. Print the boundary nodes of a binary tree.

79. Find the vertical order traversal of a binary tree.

80. Find the sum of all nodes at a given level in a binary tree.

Graph Problems

81. Implement Depth First Search (DFS) and Breadth First Search (BFS).

82. Check if a graph is bipartite.

83. Find the shortest path in an unweighted graph.

84. Detect a cycle in a directed graph.

85. Detect a cycle in an undirected graph.


86. Find the strongly connected components in a graph.

87. Implement Dijkstra's Algorithm for finding the shortest path in a weighted graph.

88. Find the minimum spanning tree of a graph using Kruskal's Algorithm.

89. Find the minimum spanning tree of a graph using Prim's Algorithm.

90. Implement the Bellman-Ford Algorithm for finding the shortest path.

91. Check if a graph is connected.

92. Find all paths between two nodes in a graph.

93. Count the number of islands in a 2D matrix.

94. Implement a function to perform topological sorting of a graph.

95. Find the number of connected components in an undirected graph.

96. Implement the Floyd-Warshall Algorithm for all pairs shortest path.

97. Find the Eulerian path in a graph.

98. Check if a graph is a tree.

99. Find the articulation points in a graph.

100. Implement the Kosaraju Algorithm for finding strongly connected components.

Dynamic Programming Problems

101. Find the nth Fibonacci number using dynamic programming.

102. Find the minimum number of coins needed to make a given amount.

103. Find the maximum sum of a subarray with no adjacent elements.

104. Solve the Longest Increasing Subsequence (LIS) problem.

105. Find the longest common subsequence (LCS) of two strings.

106. Solve the 0/1 Knapsack problem.

107. Find the number of ways to climb a staircase with 1 or 2 steps.

108. Solve the Matrix Chain Multiplication problem.

109. Find the minimum edit distance between two strings.

110. Solve the Rod Cutting problem.

111. Find the number of distinct subsequences in a string.

112. Solve the Egg Dropping problem.

113. Find the maximum profit from stock prices with at most two transactions.

114. Solve the Minimum Path Sum problem in a grid.

115. Find the longest palindromic subsequence.


116. Solve the Word Break problem.

117. Solve the Coin Change problem.

118. Find the minimum cost to reach the last cell of a matrix.

119. Find the minimum number of deletions to make a string palindrome.

120. Solve the Partition Equal Subset Sum problem.

Stack and Queue Problems

121. Implement a stack using arrays.

122. Implement a queue using arrays.

123. Implement a stack using two queues.

124. Implement a queue using two stacks.

125. Find the maximum element in a stack in O(1) time.

126. Implement a Min Stack that returns the minimum element in O(1) time.

127. Implement a circular queue.

128. Find the next greater element for every element in an array.

129. Implement a function to check if a sequence of brackets is balanced.

130. Implement a LRU (Least Recently Used) cache.

131. Find the largest rectangular area in a histogram.

132. Implement a function to evaluate a postfix expression.

133. Design a data structure to get the median of a stream of numbers.

134. Implement a function to sort a stack.

135. Implement a function to find the minimum element in a queue.

136. Implement a function to reverse the first k elements of a queue.

137. Implement a function to generate binary numbers from 1 to n using a queue.

138. Find the maximum of each subarray of size k using a deque.

139. Implement a monotonic stack.

140. Design a circular buffer using a fixed-size array.

Mathematical Problems

141. Check if a number is prime.

142. Find the greatest common divisor (GCD) of two numbers.

143. Implement a function to find all prime numbers up to n using the Sieve of
Eratosthenes.
144. Find the factorial of a number using recursion.

145. Find the number of trailing zeroes in the factorial of a number.

146. Check if a number is a perfect square.

147. Calculate the power of a number using exponentiation by squaring.

148. Check if a number is an Armstrong number.

149. Find the sum of the digits of a number.

150. Find the nth Catalan number.

151. Find the nth Fibonacci number modulo m.

152. Implement the Euclidean algorithm for GCD.

153. Find the sum of all divisors of a number.

154. Check if a number is a perfect number.

155. Find the LCM (Least Common Multiple) of two numbers.

156. Solve the Josephus problem.

157. Implement the fast exponentiation algorithm.

158. Find all factors of a number.

159. Find the largest prime factor of a number.

160. Check if a number is a power of two.

Bit Manipulation Problems

161. Find the single number in an array where every other number appears twice.

162. Count the number of 1s in the binary representation of a number.

163. Find the two non-repeating elements in an array where every other element repeats.

164. Find the missing number in an array of integers from 1 to n using XOR.

165. Swap two numbers without using a temporary variable.

166. Find the XOR of all numbers from 1 to n.

167. Reverse the bits of a given number.

168. Check if a number is a power of four.

169. Determine if two numbers have opposite signs.

170. Find the next higher number with the same number of 1 bits in binary
representation.

Recursion and Backtracking Problems

171. Solve the N-Queens problem.


172. Generate all subsets of a given set.

173. Solve the Rat in a Maze problem.

174. Implement the Tower of Hanoi.

175. Find all permutations of a given string or array.

176. Generate all valid combinations of n pairs of parentheses.

177. Find all combinations of numbers that sum to a target.

178. Solve the Sudoku puzzle.

179. Find the word in a board using backtracking.

180. Implement a function to find all Hamiltonian paths in a graph.

Searching and Sorting Problems

181. Implement binary search in a sorted array.

182. Implement merge sort.

183. Implement quicksort.

184. Implement insertion sort.

185. Find the first occurrence of a target value in a sorted array.

186. Find the peak element in an array.

187. Implement heap sort.

188. Find the kth largest element in an array.

189. Find the inversion count in an array.

190. Implement counting sort.

191. Implement radix sort.

192. Find the median of two sorted arrays.

193. Implement bucket sort.

194. Search an element in a sorted and rotated array.

195. Implement the closest pair problem.

196. Find the first and last position of a target element in a sorted array.

197. Check if an array can be divided into two subsets with equal sum.

198. Find the smallest missing positive integer in an unsorted array.

199. Implement the Dutch National Flag problem (3-way partitioning).

200. Find the smallest range that includes at least one number from each of the k lists.

You might also like