def is_palindrome(s): return s == s[::-1]
Given a number N , calculate the sum of its prime factors. Tcs Coding Questions 2021
def find_nth_term(n): if n % 2 == 0: # even position return 3 ** (n//2 - 1) else: # odd position return 2 ** (n//2) def is_palindrome(s): return s == s[::-1] Given a
Do not just memorize the code. Understand the why behind the logic. TCS is looking for engineers who can debug and adapt. Take the six questions listed above, write them from scratch three times each, and you will be more prepared than 90% of candidates who sat for the 2021 exam. TCS is looking for engineers who can debug and adapt
Rotated array.
Given a number N , write a program to obtain a number M by reversing the digits of N . If M contains trailing zeros, they must be removed (which happens naturally during integer reversal).