Leetcode - Implement Rand10() Using Rand7() (Python)

preview_player
Показать описание
August 2020 Leetcode Challenge
Leetcode - Implement Rand10() Using Rand7()
Рекомендации по теме
Комментарии
Автор

Could you explain, why the last 9 elements in the table aren't uniform? Why we have to reroll?

peskovdev
Автор

so i couldn't figure out why we have to decrement out rand7 numbers by 1? if you just did rand7() without offsetting it, it passes test cases, but only up to n = 1000....

so it kinda works, but im still having a hard time grasping why we need to subtract 1

janmichaelaustria
visit shbcf.ru