Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You make a good point, and there is definitely some value to including that step (although it would be only another 2 lines of code actually.) I considered putting it in, but didn't because of the following:

1. The only leap of logic required is to realize that the two options are mutually exclusive: either you win by staying or you win by switching. There is no alternative.

2. Writing the code in that concise form, I believe the inherent structure of the problem is much clearer than the mess of classes and function calls.



Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: