Test case # 1 is failing
Pythagorus Triplet
Hi Nirbhay,
There’s nothing wrong with your code and logic. Everything is spot on and correct except one little disastrous mistake in your print statement.
In java when we do a System.out.print and add a ‘+’ symbol all the elements after that act as a string instead of a normal value.
If you try to print:
System.out.println(1 + " " + 5 +4);
Output will be: 1 54 instead of the expected 1 9
Similarly in your code, when you print:
System.out.println(val - 1 + " " + val + 1);
There will be an extra 1 printed instead of the output you expected. Your code should work if you correct that small mistake of yours.