Important algorithm for FAANG coding interview | fast & slow pointers | leetcode 876

preview_player
Показать описание
#coding #leetcode #python #javascript
Рекомендации по теме
Комментарии
Автор

You technically go through the list 1.5 times.

kzco-iqcw
Автор

This in not an important algorithm. If finding the middle element is really the performance bottleneck, use an array. So you get O(1). This is O(n).

simon
Автор

Except you are actually making 2 oasses (well 1.5, which is all you would need if you kept a count and did it serially instead of staggered). So it doesn’t save space, time, or computational bandwidth. Trick questions are stupid.

davea
Автор

What if theres an even number of nodes

andrew
join shbcf.ru