Skip to content
We areTOP 1%

K-th Symbol in Grammar

MediumLeetCodeRecursion
Solve on LeetCode(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Row n is row n - 1 followed by its complement. Decide whether position k lies in the first or second half and recurse on row n - 1, flipping the result for the second half.

More in Recursion

Recursion questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Fibonacci NumberLeetCodeEasy Solve Fibonacci Number on LeetCode (opens in a new tab)
2Sum in Binary TreeCodeforcesEasy 800Solve Sum in Binary Tree on Codeforces (opens in a new tab)
3Lucky DivisionCodeforcesEasy 1000Solve Lucky Division on Codeforces (opens in a new tab)
4Little Elephant and FunctionCodeforcesEasy 1000Solve Little Elephant and Function on Codeforces (opens in a new tab)
5Tavas and SaDDasCodeforcesEasy 1100Solve Tavas and SaDDas on Codeforces (opens in a new tab)
6Petr and a Combination LockCodeforcesEasy 1200Solve Petr and a Combination Lock on Codeforces (opens in a new tab)
7Pow(x, n)LeetCodeMedium Solve Pow(x, n) on LeetCode (opens in a new tab)
8Count Good NumbersLeetCodeMedium Solve Count Good Numbers on LeetCode (opens in a new tab)
9Sort an ArrayLeetCodeMedium Solve Sort an Array on LeetCode (opens in a new tab)
10K-th Symbol in GrammarLeetCodeMedium Solve K-th Symbol in Grammar on LeetCode (opens in a new tab)
11Find the Winner of the Circular GameLeetCodeMedium Solve Find the Winner of the Circular Game on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account