Tcs Coding Questions 2021 <UHD 2024>
TCS Coding Questions 2021: A Complete Analysis
int main() char str[100]; scanf("%[^\n]s", str); // Read string with spaces
2. Check if a string is a palindrome
String Challenges
: Frequent topics included checking for palindromes, counting vowels/consonants, and determining if two strings were anagrams using frequency counters (Hash Maps) for optimization. Tcs Coding Questions 2021
: Finding the second largest/smallest element, rotating an array by positions, and finding missing numbers in a sequence. String Manipulation TCS Coding Questions 2021: A Complete Analysis int
Here are the most frequently asked patterns, reconstructed from student memory and forums like PrepInsta, GeeksforGeeks, and CodeChef discussions. Input: An integer N (size of the array),
Input format:
First line: N K Second line: N integers.
for(int i = 0; i < n; i++) cin >> arr[i];
- Input: An integer
N(size of the array), followed byNintegers. - Output: The modified array.
- Constraint:
Nis always even.