Tcs Coding Questions 2021 2021 [ SAFE ✭ ]
if(flag == 1) cout << "True"; else cout << "False";
"1001" → Choose substring indices 1 to 3 ("001")? Actually original: 1 0 0 1. Pick substring positions 2-4 (0,0,1) has only one '1'. Not allowed. This was so tricky that TCS 2021 actually had a simpler version: Count the number of groups of consecutive '1's.
arr = list(map(int, input().split())) target = int(input()) print(count_pairs(arr, target))
Good luck. Your TCS career starts with a single System.out.println("Hello World"); — make it count.
if(flag == 1) cout << "True"; else cout << "False";
"1001" → Choose substring indices 1 to 3 ("001")? Actually original: 1 0 0 1. Pick substring positions 2-4 (0,0,1) has only one '1'. Not allowed. This was so tricky that TCS 2021 actually had a simpler version: Count the number of groups of consecutive '1's.
arr = list(map(int, input().split())) target = int(input()) print(count_pairs(arr, target))
Good luck. Your TCS career starts with a single System.out.println("Hello World"); — make it count.