Eleven36 Blog Trend Report Product Conditions Return Policy menu

Expert guidance available Mon-Fri.

(8am-5pm CT) forum Chat (With a real person, not a bot.)
forum

Tcs Coding Questions — 2021

Input: [11, 23, 41, 29, 56] Output: 3 (Because 11→1+1=2(prime), 23→2+3=5(prime), 41→4+1=5(prime), 29 is prime but 2+9=11(prime) actually also qualifies—so 4? Wait: 56 is not prime. So output is 4).

Q1 Solution: Sieve of Eratosthenes

A teacher writes a sentence. She wants to reverse the words that have an even length, but leave odd-length words unchanged. Print the final sentence. Example: Input: "Hello World Python" → Output: "olleH World nohtyP" Tcs Coding Questions 2021

Write a program to find the sum of all prime numbers between two given integers L and R (inclusive). Constraints: 1 ≤ L ≤ R ≤ 10^6. Input: [11, 23, 41, 29, 56] Output: 3

Q2 Solution: String reversal