- #1

- 863

- 4

Essentially, minimize the number of buckets while maintaining countability.

I was asked this question in a job interview, and would like to hear your answers.

- Thread starter KingNothing
- Start date

- #1

- 863

- 4

Essentially, minimize the number of buckets while maintaining countability.

I was asked this question in a job interview, and would like to hear your answers.

- #2

- 459

- 0

- #3

- 863

- 4

That's the answer I gave: populate the buckets with powers of two and put the remainder in one "overflow" bucket.1 marble, 2 marbles, 4, 8, ... That would allow you to fill any order.

The customer may ask for any number of marbles, but they don't care how many buckets they get. You only care how many buckets you store.

- Last Post

- Replies
- 5

- Views
- 718

- Last Post

- Replies
- 5

- Views
- 2K

- Replies
- 7

- Views
- 4K

- Replies
- 3

- Views
- 9K

- Replies
- 1

- Views
- 1K

- Replies
- 13

- Views
- 3K

- Replies
- 2

- Views
- 875

- Last Post

- Replies
- 2

- Views
- 2K

- Last Post

- Replies
- 12

- Views
- 3K

- Last Post

- Replies
- 5

- Views
- 706