Sort by

recency

|

90 Discussions

|

  • + 1 comment

    C# implementation:

    static string strings_xor(string s, string t)
    {
        string result = "";
    
        for(int i = 0; i < s.Length; i++)
        {
    
            result += s[i] == t[i] ? '0' : '1';
        }
    
        return result;
    }
    

    Compiler is saying "Wrong Answer".

    • + 0 comments

      As the condition said, only modified 3 lines of code to run the program. It's easy for python, but i don't know how to run in other languages.

  • + 0 comments

    include

    using namespace std;

    string strings_xor(string s, string t) {

    string res = "";
    for(int i = 0; i < s.length(); i++) {
        if(s[i] == t[i])
            res.push_back('0');
        else
            res.push_back('1');
    }
    return res;
    

    }

    int main() { string s, t; cin >> s >> t; cout << strings_xor(s, t) << endl; return 0; } ** still the compiler is saying "Wrong Answer"

    the

  • + 0 comments

    Here is my Python solution!

    def strings_xor(s, t):
        res = ""
        for i in range(len(s)):
            if s[i] == t[i]:
                res += '0'
            else:
                res += '1'
    
        return res
    
    s = input()
    t = input()
    print(strings_xor(s, t))
    
  • + 0 comments

    Here is my c++ working solution, you can watch the explanation here : https://youtu.be/eCWFW0phR-4.

    Keep in mind that it's not just about getting the right answer, it's also about making at most three changes, so an extra space on a new line will cause your code to fail, you can get a demo in the video above.

    string strings_xor(string s, string t) {
    
        string res = "";
        for(int i = 0; i < s.size(); i++) {
            if(s[i] == t[i])
                res += '0';
            else
                res += '1';
        }
    
        return res;
    }
    
  • + 1 comment

    Hello, I am solving this with one line of code on JS. I am a new coder so I may be wrong somewhere. I am achieving the correct result in std.out but when i run the test is not passing me. Please let me know if i am missing anything?

    process.stdin.resume(); process.stdin.setEncoding("ascii"); var input = ""; process.stdin.on("data", function (chunk) { input += chunk; }); process.stdin.on("end", function () { // now we can read/parse input console.log(Number(input.split("\n")[0]) ^ Number(input.split("\n")[1])); });

    • + 0 comments

      You are likely removing lines or adding new lines, which will result in a score of 0. You need to edit three lines, without adding or removing any.