Search
⌘K

Leetcode 2689. Extract Kth Character From The Rope Tree

Given a rope implemented as a binary tree where leaves hold characters/strings and internal nodes store the length (weight) of their left subtree, return the k-th character of the full concatenated string by traversing the tree using those weights to decide left vs right. Aim for O(height) time by comparing k to left-subtree weights and adjusting k as you descend.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.