3 ms·
I've been doing "daily leetcode" for fun, just to remember how to write code manually without agents, and a few days ago they gave a brain teaser kind of task [
by ventana 2mo ago
I've been doing "daily leetcode" for fun, just to remember how to write code manually without agents, and a few days ago they gave a brain teaser kind of task [1], for which the solution was just [2] (spoiler alert). It took me quite some time to come to that solution, and I'm not really sure I would've found it with all the stress of being on a real interview.
[1]: https://leetcode.com/problems/stone-game/ https://leetcode.com/problems/stone-game/
[2]: return True
- viccis 2mo agoYeah one of the worst offenders of this are the leetcode problems that have a clever but extremely elegantly simple greedy algorithm (such as "return True" lol). Great example is Majority Element [1] The answer seems pretty clear when you think about it enough, even the proof seems like it makes sense. The problem is marked Easy on Leetcode. But coming up with the algorithm and proving its correctness is a two-name algorithm with its own Wikipedia article. In your example, the challenge isn't even really to "design" that algorithm, it's to prove that it's true. 1: https://leetcode.com/problems/majority-element https://leetcode.com/problems/majority-element 2: https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_majority_vote_algorithm https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_majority_v...