vijaygupta18 / Hacktoberfest-2022

An Open Source repository to Teach people How to contribute to open sources.
MIT License
96 stars 331 forks source link

Added Kth Symbol Grammar #561

Closed alhad-balak closed 3 years ago

alhad-balak commented 3 years ago

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.