Добавить
Уведомления

leetCode 34 Find First and Last Position of Element in Sorted Array (Recursion & Iteration)

leetCode 34 Find First and Last Position of Element in Sorted Array Common Binary Search Problem, just analyze enough the characteristics of the problem, straightforward approach would be recursion, and it also could be rewritten in Iteration(with Two Cursors from left and Right). For recursion, always pay attention to whether it is tail recursion or not, it affects the space complexity You can find my solution here: https://github.com/JSerZANP/leetCode_solutions/blob/main/34-find-first-and-last-position-of-element-in-sorted-array.md Hi I'm a JavaScript engineer who is not good at algorithms, and currently practicing leetCode online. If you are interested, maybe we can learn together.

Иконка канала JavaScript Боты
15 подписчиков
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

leetCode 34 Find First and Last Position of Element in Sorted Array Common Binary Search Problem, just analyze enough the characteristics of the problem, straightforward approach would be recursion, and it also could be rewritten in Iteration(with Two Cursors from left and Right). For recursion, always pay attention to whether it is tail recursion or not, it affects the space complexity You can find my solution here: https://github.com/JSerZANP/leetCode_solutions/blob/main/34-find-first-and-last-position-of-element-in-sorted-array.md Hi I'm a JavaScript engineer who is not good at algorithms, and currently practicing leetCode online. If you are interested, maybe we can learn together.

, чтобы оставлять комментарии