Coding_Questions_Service_Companies
Coding_Questions_Service_Companies
This PDF contains a curated list of 50+ most frequently asked and important array and string
questions for service-based company placement rounds (TCS, Infosys, Wipro, Capgemini,
Accenture).
Array Questions
1. Find the maximum and minimum element in an array
2. Find the second largest and second smallest elements
3. Reverse the array
4. Sort an array of 0s, 1s, and 2s
5. Find the missing number in an array from 1 to n
6. Find duplicate elements in an array
7. Move all zeroes to end of array
8. Check if array is sorted
9. Count frequency of each element
10. Find the number that appears once while others appear twice
11. Find leaders in an array
12. Maximum difference between two elements such that larger appears after smaller
13. Subarray with given sum (Sliding Window)
14. Kadanes algorithm - Maximum subarray sum
15. Merge two sorted arrays
16. Union and Intersection of two arrays
17. Left rotate the array by D places
18. Count pairs with given sum
19. Find equilibrium index
20. Rearrange array in alternating positive and negative items
String Questions
21. Check if a string is a palindrome
22. Reverse a string
23. Reverse words in a given string
24. Check if two strings are anagrams
25. Count vowels and consonants in a string
26. Remove duplicate characters from a string
27. Check if a string contains only digits
28. Check if two strings are rotations of each other
29. Find first non-repeating character
30. Longest common prefix among array of strings
31. Implement strstr() (substring match)
32. Count words in a string
33. Print all substrings of a string
34. Check for balanced parentheses
35. Change case of characters in string
36. Find duplicate characters in string
37. Check if characters of one string are present in another
38. Find the most frequent character in a string
39. Compress the string (basic run length encoding)
40. Remove spaces from a string
Important Topics
Important Array Topics:
- Array Traversal and Manipulation
- Sorting Techniques (Bubble, Insertion, etc.)
- Prefix Sum and Sliding Window
- Frequency Hashing (using maps or arrays)
- Two Pointer Technique
- Searching (Linear/Binary)