K-th Symbol in Grammar

A table is built row by row starting with 0 in the first row. For each subsequent row, every 0 is replaced by 01 and every 1 is replaced by 10. Given row number n and position k (both 1-indexed), return the symbol at that position in the nth row.

Examples
Input: [1,1]
Output: 0
Hints

K-th Symbol in Grammar

A table is built row by row starting with `0` in the first row. For each subsequent row, every `0` is replaced by `01` and every `1` is replaced by `10`. Given row number `n` and position `k` (both 1-indexed), return the symbol at that position in the nth row.