K-th Symbol in Grammar | Python Recursive Solution

preview_player
Показать описание
Time Complexity: O(n log k), each recursive call divides the k by half
Space Complexity: O (n), the recursive stack goes through n levels
Рекомендации по теме
Комментарии
Автор

This is a great explanation for the recursive solution. Thanks for posting the video. Out of curiosity, did you find the recursive solution easier or the iterative one using binary search? I just finished reviewing the Recursion I on Leetcode, and the relationship of k to the parent's k was not very obvious to me 😕

gregoryrobertson
visit shbcf.ru