NeetCode #208LC-779MediumTwo Pointers
← Back to All Problems

#208 · #779 · K-th Symbol in Grammar(第 K 个语法符号)

📌 Problem Statement & Constraints

We build row 1 as 0. Row i is obtained from row i-1 by replacing each 0 with 01 and each 1 with 10. Given n and k (1-indexed), return the k-th symbol in row n. Constraints: 1 <= n <= 30, 1 <= k <= 2^(n-1).
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!