Tcs Coding Questions 2021 Verified | 2024 |

Given a string, find the first non-repeating character in it.

print(first_non_repeating_char("aabbc")) # Output: "c"

Here are some TCS coding questions from 2021, along with a useful piece of code for each:

Given an array of integers, find the maximum sum of a subarray.

def find_middle_element(head): slow = head fast = head

return max_sum

Given a string, find the first non-repeating character in it.

print(first_non_repeating_char("aabbc")) # Output: "c"

Here are some TCS coding questions from 2021, along with a useful piece of code for each:

Given an array of integers, find the maximum sum of a subarray.

def find_middle_element(head): slow = head fast = head

return max_sum