I’m trying to build an online coding contest platform.
As of now, the method I’m using to compare the output is:
After submitting the solution, let’s assume the question has 5 test cases. I send one test case as input along with the solution, then compare the user’s output with the stored actual output, one by one for each test case.
The problem I’m facing:
Let’s assume the output is an array, and the elements can be in any order, or between indices i and j the order can be different. However, the output I store in my database will be in only one specific order (right?). If the user’s order is different, how will I compare the outputs? I can use the brute force method to compare for specific cases, but questions can have any type of output, so I would have to write code for each case.
Is there a good approach to handle this? Please help.