4 ms·
> Ever try or even see a "Leet-Code" style question that stated the problem without providing example results? [...] How do you ever know you got the correct re
by CrazyStat 5y ago
> Ever try or even see a "Leet-Code" style question that stated the problem without providing example results? [...] How do you ever know you got the correct result? You don't. Perhaps worse, you are confident in a "solution" that includes an "off by 1" bug.
Yes. Well, no--even worse. When I took intro CS in college many years ago we were given a problem with incorrect example results due to an off-by-one error in the code written by a TA. After many hours of banging my head against the desk and eventually working several cases out by hand on paper, I pointed this out to the professor. Rather than correct the error he emailed the class that the example results were only intended to demonstrate the formatting of the input and output, and should not be relied on to be correct.
- Tobani 5y agoI had a similar problem. Where we were supposed to do some sort of optimization (loop unrolling or something) to a function. We had done this several times throughout the course. But this time loop was slightly different (unintentionally) and I managed to construct some answer that I wasn't happy with and turned in the exam last. We got the papers back and of course mine was wrong in spite of producing correct results, while everybody who blinding applied the wrought memorized mechanization we had learned got it right. It took forever for that professor to understand how bad the question was.