Commit e53812e
committed
Use the leetcode assessment of test correctness
The code currently decides whether or not the answer is the expected
answer by comparing the `code_answer` and `expected_code_answer`
output blocks in the response to see if they're the same. This can be
an issue for problems where the output is a list but the problem
specifies that the order doesn't matter. For instance, for problem
49 (Group Anagrams) the problem states that "You can return the answer
in **any order**." However, running my solution to that problem gave:
FAIL:
Code Answer:
[["eat","tea","ate"],["tan","nat"],["bat"]]
[[""]]
[["a"]]
Expected Code Answer:
[["bat"],["nat","tan"],["ate","eat","tea"]]
[[""]]
[["a"]]
in the `*leetcode-result-49*` buffer. The problem here is that the
we're not respecting the order-insensitivity of the answer the problem
specifies.
Looking at the result data structure, we see that there is also a
`correct_answer` field which is the Leetcode assessment of whether the
answer was correct or not. For example, in the case shown above the
"correct_answer" field is set to "true".
This change uses the "correct_answer" field to decide whether the test
passed or failed, rather than comparing the output blocks directly.1 parent f61ad97 commit e53812e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | | - | |
| 1037 | + | |
1038 | 1038 | | |
1039 | 1039 | | |
1040 | 1040 | | |
| |||
0 commit comments