Solved Kth Symbol in Grammar using recursion.
In kth Symbol-in-grammar, Build a table of n rows (that indexed from 1). Let's start by writing 0 in the 1st row. 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. In the kth (column) symbol in the nth row of a table of n rows is the required answer.
Solved Kth Symbol in Grammar using recursion. In kth Symbol-in-grammar, Build a table of n rows (that indexed from 1). Let's start by writing 0 in the 1st row. 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. In the kth (column) symbol in the nth row of a table of n rows is the required answer.