We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Debugging
- XOR Strings
- Discussions
XOR Strings
XOR Strings
Sort by
recency
|
96 Discussions
|
Please Login in order to post a comment
Title: Java 8 Environment Issue: Strings XOR Challenge
Problem Link: https://www.hackerrank.com/challenges/strings-xor/problem
Description of Bug: There appears to be a formatting mismatch in the automated test cases for Java 8. While the logic is correct and passes when using the "Test against custom input" feature with identical input strings, it fails with a "Wrong Answer" during a standard run or submission.
Technical Details:
Language: Java 8.
Symptom: The "Your Output" and "Expected Output" appear identical in the diff viewer, but the test fails.
Hypothesis: The hidden test cases likely contain trailing whitespace or carriage returns (\r) that are being captured by Scanner.nextLine() or Scanner.next() in the Java 8 environment, causing a byte-comparison failure.
Comparison: The Java 7 environment for the same problem provides a pre-filled template that seems to bypass this, whereas the Java 8 environment starts with an empty main method, making it more susceptible to these buffer issues.
Suggested Fix: Please verify the line endings of the hidden test cases or update the Java 8 boilerplate to use a more robust input method (like a pre-configured BufferedReader or Scanner with a specific delimiter).
There is a bug in that problem that prevented me from seeing the funcetion strings_xor in several languages, including JavaScript (Node.js), C, Java 8, haskell, Perl, PHP, and more. and when I write a single script, the compiler rejects it and displays an incorrect answer because of the condition.
You will have to read through the questions thoroughly, which clearly states 3 lines mods... Here are my C++ changes to fix the issue
something does seem to be wrong with the "grader" for both supported C++ versions. Take a look at the results, after I made the [3 quick-and-simple] fixes…
Compiler Message
Wrong Answer
Input (stdin)
Your Output (stdout)
Expected Output
Many languages where there is no code should be hidden... if that a thing. And something's wrong with C++ grader?