News for hackers. Stuff that matters.
Re:I Am So Sick of Leetcode-Style Interviews by krackers on Tuesday June 04, 2024 @03:35PM (#40578154)
>shuffle a deck of cards

Fwiw this is surprisingly subtle and non-trivial to get right. A naive "random swap" approach does not produce uniform permutations. Sorting based on a random comparison function can likewise produce biased results depending on the implementation of the sort. Tagging each element with a random number and then sorting based on the tag works (or so I think?) but you need to deal with the case where tags collide. Fisher-yates shuffle is bulletproof but I would not trust myself to write it from memory lest you end up writing Sattolo's algorithm instead.

Re:I Am So Sick of Leetcode-Style Interviews by gumby on Tuesday June 04, 2024 @05:05PM (#40578926)
It’s an open ended problem and someone could nerd out on the maths while another could define a card class, a suit class, and use a factory pattern (oh brother…SMH but probably wouldn’t categorically rule someone out for it, just talk some more).

At the end of the day the question is: “could this person do the job and could they work with others in the process?”

Re:I Am So Sick of Leetcode-Style Interviews by chuckadams on Tuesday June 04, 2024 @11:34PM (#40581118)
The problem isn’t about getting the perfect answer, it’s about observing the process, and conversing about the answer afterwards. I’d be fine hiring the candidate who whiffs the shuffle but knows about Fisher-Yeats and says they’d look for a well-tested implementation and drop it in. I mean that can’t be their answer to everything, but evidence of real experience should grant a Mulligan now and then. Coding interviews cannot be code themselves.