Perfect Shuffle an Array (JavaScript Coding Interview)

preview_player
Показать описание
Shuffling is a very well understood programming challenge. It is also a pretty common coding interview question. In this lesson we look at how you efficiently implement it in #JavaScript 🌹

Course Page:

#basarat

👇 ❤️ Subscribe for MOORE ❤️ 👇

**Feel Free To Read This Lot**

I'm Basarat, and I love helping developers. More about me:

Microsoft MVP for TypeScript
200K contributions on Stackoverflow. Top Contributor for TypeScript.
Book Author : Beginning NodeJS
Book Author : TypeScript Deep Dive
Creator of multiple hot ✨ed Github Open Source projects

Рекомендации по теме
Комментарии
Автор

what about making a guarantee, that after shuffling, no item will remain in their original index in the resulting array?
This algorithm can leave items in their original index as the input array.

marslogics
Автор

Can you explain how your version of shuffling is different than just randomly picking an index and splicing off that index after reach iteration until there are no more items to shuffle?

jaya
join shbcf.ru