
Jacob B. answered 09/16/19
UCLA Perfect Scorer (1600) w/ 7+ Years of SAT Teaching Expertise
Thinking through this problem in terms of differences between starting values helps to simplify it dramatically. Consider different starting conditions: what if there are two more reds than greens? What are the possible outcomes then? Make sure to watch the video in high quality so that you can read the code. I've pasted the code below, which you can fiddle around with on an online IDE should you please:
Naz N.
I get some error in if (Math.random() <= proportionReds && reds > 0) , any idea about that ?09/20/19