Skip to content

Instantly share code, notes, and snippets.

Samuel Hapák hleumas

Block or report user

Report or block hleumas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dice.md

Dice

Solution to this problem: https://twitter.com/nntaleb/status/907204053079400448

Solution

The dice will be rolled no more than 3 times. Smallest even number is 2 and 2x3=6, which is the desired sum.

Now, the problem statement says that we roll the dice only until we get the sum of 6 or more. Yet, nothing would change, if we rolled the dice exactly for 3 times, but ignored all rolls after we reach 6.

Now, naive solution would be to generate all triplets from numbers 2, 4, 6 and determine how many of them achieved sum >=6 after first, second, or third item. It's the very same thing Nassim Nicholas Taleb has done here: https://twitter.com/nntaleb/status/907211482743668737

@hleumas
hleumas / stores.js
Created Jul 31, 2015
Compose stores
View stores.js
import {fromJS} from 'immutable'
import userActions from './userActions'
const userInitialState = fromJS({
logged: false
})
function userStore(state = userInitialState, action, payload) {
switch (action) {
case userActions.loggedIn:
return state.set('logged', true)
You can’t perform that action at this time.