Sort by

recency

|

96 Discussions

|

  • + 0 comments

    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).

  • + 0 comments

    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.

  • + 0 comments

    You will have to read through the questions thoroughly, which clearly states 3 lines mods... Here are my C++ changes to fix the issue

    for (int i = 0; i < s.size(); i++)
    {
      if ((s[i] == t[i]) && ((s[i] == '0') || (s[i] == '1'))) //1st change
         res += '0';   //2nd change
        else
          res += '1';   //3rd change
    }
    
  • + 1 comment

    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)

    10101
    
    00101
    

    Your Output (stdout)

    10000
    

    Expected Output

    10000
    
  • + 0 comments

    Many languages where there is no code should be hidden... if that a thing. And something's wrong with C++ grader?