Monday, August 21, 2017

CodeForces: Ultra Fast Mathematician-61A Solution in Java

Ultra Fast Mathematician-61A Problem Link

Solution Link in Java

The problem is a simple one. If you learn Java Strings, it'll be a piece of cake. I suggest you try the problem yourself before proceeding. As a quick reminder, check out this short java string tutorial from tutorialspoint  as a guide to this problem.

Now let's come to our solution. After taking the input, we enter a for loop with range from 0 to n-1 , where n is the length of the input string(both strings have the same length). We extract one character from each string and put them in two character variable a and b.

We now check whether they are the same character or not. If they are the same, we output 0. Otherwise, we print out 1 since a and b are not same characters.

After the loop is finished, we get the desired output binary string.

If you face any problem or have any other suggestion, feel free to post a comment.

Don't forget to share and subscribe.

1 comment:

  1. Hi,

    Useful post. Very well explained. Thanks for sharing.



Interview Questions at Enosis(Part 3)

In Part 2 , I have discussed 3 coding problems out of 6. Here we will talk about the next 3 coding problems. Problem 4: Write a function...