Implement Rand10() Using Rand7() | Day 28 | [ August LeetCoding Challenge ] [ Leetcode ] [ 2020 ]

preview_player
Показать описание
The day 28 problem in August Leetcoding Challenge. ( Implement Rand10() Using Rand7() ).

Check out our other popular playlists:

Problem statement:

Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer in the range 1 to 10.



Example 1:

Input: 1
Output: [7]
Example 2:

Input: 2
Output: [8,4]
Example 3:

Input: 3
Output: [8,1,10]


Note:

rand7 is predefined.
Each testcase has one argument: n, the number of times that rand10 is called.

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #interview #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

We hope you all are enjoying the August leetcoding challenge!!! Don't forget to leave a comment!!! Please like the video to support us!!!
Questions you might like:
Struggling in a question??
Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

Very easy and to the point explanation

malayshah
Автор

3:05 Please correct this. 7*(rand7()-1)
But not 10*(rand7()-1)

codestorywithMIK
Автор

Coud you please explain why index should not cross 40 because we can have values till 49 which are valid

aryanagarwal
Автор

second method wont give 0-66 but 0-6 10-16 and so on..

ashitrai
join shbcf.ru