Question: On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0

On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence of 1 with 10. Given row N and index K, return the K-th indexed symbol in row N. (The values of K are

1-indexed) Constraints: N will be an integer in the range [1, 30]. K will be an integer in the range [1, 2 N1 ]

Sample Input: 1 1 2 1 2 2 4 5 Sample Output: 0 0 1 1 Explanation: row 1: 0 row 2: 01 row 3: 0110 row 4: 01101001

Using C language (Recursion)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!