Hacker News new | past | comments | ask | show | jobs | submit login

I actually ran the interview on some coworkers for fun (they volunteered) and it was interesting to see the more senior (& IMO brighter) folks quickly recognize code reuse.

!@! SPOILER BELOW !@!

!@! SPOILER BELOW !@!

high card -> sort cards by value return cards[4]

Count cards (map[value]->int) --> Pair, pairs, triples, four of a kind

For each card is first token match? --> flush

sort cards , card[0] == card[4] + 4? --> straight

straight flush --> straight && flush

royal flush --> highcard == A && straight && flush




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: