My favorite solution like this I saw was from grading an Algorithms class.
The assignment was "turn this min-heap implementation into a max-heap implementation". The correct solution was to flip the tests correctly.
The solution I liked the best just negated all the values as they came in, and negated them again as they came out, so as long as you were inserting numeric values, everything worked out! It was a) delightful and b) totally missing the point of the assignment, so I felt bad about marking it down, but the point was to demonstrate knowledge of heaps, and the proposed solution would have worked whether the internals were a heap or not.
The assignment was "turn this min-heap implementation into a max-heap implementation". The correct solution was to flip the tests correctly.
The solution I liked the best just negated all the values as they came in, and negated them again as they came out, so as long as you were inserting numeric values, everything worked out! It was a) delightful and b) totally missing the point of the assignment, so I felt bad about marking it down, but the point was to demonstrate knowledge of heaps, and the proposed solution would have worked whether the internals were a heap or not.