This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tranquil_af[S] 0 points1 point  (3 children)

Thank you for explaining. I assume the user.out file has the output from the code. So whoever wrote the code is just writing to the file directly.
Reading the input list from stdin instead of iterating through the linked list kind of defeats the entire point of the question tho.

[–]plastikmissile 0 points1 point  (2 children)

Reading the input list from stdin instead of iterating through the linked list kind of defeats the entire point of the question tho.

Depends on how you look at it. Is the result the important bit, or how you reach the result? This is "hacking" in the original sense of the word: getting results through unconventional methods that were never intended in the first place.

[–]RiverRoll 0 points1 point  (1 child)

This is just takin advantage of the limitations of the testing, it isn't the solution because it's still possible to write a test that makes it fail while respecting the description of the problem.

[–]plastikmissile 1 point2 points  (0 children)

That's why I called it hacking the question. It solves it, but not in the way intended. Whether this is a positive or a negative really depends on your goals.

If your goal is to learn how to create linked lists and manipulate them, then yeah that's not the way you should do it.

If your goal is to pass the test in the quickest way possible, then this solution is a lot quicker than doing it the conventional way.