Tcs Coding Questions 2021 < 2026 >
Given a string, find the first non-repeating character in it.
for char in s: if char_count[char] == 1: return char
def find_middle_element(head): slow = head fast = head Tcs Coding Questions 2021
Example: Input - 1 -> 2 -> 3 -> 4 -> 5, Output - 3
class Node: def __init__(self, data): self.data = data self.next = None Given a string, find the first non-repeating character in it
Example: Input - [1, 2, 3, 4, 5], target sum - 7, Output - 2
return max_sum
print(first_non_repeating_char("aabbc")) # Output: "c"