Questions 2021 | Tcs Coding

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

while fast and fast.next: slow = slow.next fast = fast.next.next

for num in arr: complement = target_sum - num if complement in seen: count += 1 seen.add(num) Tcs Coding Questions 2021

print(count_pairs_with_sum([1, 2, 3, 4, 5], 7)) # Output: 2

return max_sum

print(find_middle_element(head)) # Output: 3

Given an array of integers and a target sum, count the number of pairs with that sum. Given a string, find the first non-repeating character in it

return slow.data