Adobe | Product Intern | Noida/Bangalore | Implement dice
Anonymous User
1272

Initially we discussed about my project, and then some CS basics

Then I was asked to open any IDE of my choice, and solve the below problem -

Given a function toss() which will equally likely return 1 or 2 as its output.

Task 1: Design a dice() function that mimics a fair six-sided dice roll (1 to 6), without relying on any built-in random number generators (rand() or similar).

Task 2: Wrap your entire logic in a loop, running it 1000 times. Keep track of the occurrences of each dice face (1 to 6).

After completion of task 2, we discussed the code flow and how compiler will behave if we are taking static vs const vs normal variable for task 2.

Result - After a long wait of 10 days, I finally got the good news

For soultion - https://leetcode.com/discuss/interview-question/4416141/Adobe-or-Phone-or-Implement-dice-solution

If you liked the question, don't forget to give my post an upvote to spread the coding joy. Happy coding! Best of luck for your preparations!

Comments (8)