onsite
Round 1 - basic qns in synchronization primitives. given pthread APIs , need to synchronize two threads to print odd and even numbers respectively and only upto 10 and then exit.
Round 2 - The objective here is to populate an array of a given size in a 'snakelike' pattern up and down like so:
Given an empty array of 3x3, the array should look like this at the end:
0 5 6 11.
1 4 7 10
2 3 8 9
In my mind this looked like a matrix leetcode problem, so I first proposed a brute force approach and tried
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
███████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████