My answer is correct but the question does not accept it.

Question : CIELAB.

import java.util.*;

public class Main


public static void main(String []args)


    Scanner sc=new Scanner(;

    long a,b,x,d;

    x=x * 10+d;


Check out my solution to clear the implementation and algorithmic part-

EDIT- Still finding test case where your code fails.

Check the constraints, 1 <= B < A <= 10000. The first number is always greater than the second.

Okay, yes, you are correct. IDK why it emphasized “your answer must be positive number…” in output section then :confused:

Edited that part out. Thanks for pointing it out!! :slight_smile:

Check this test case :

10 1
Your output: 0 ; which is wrong as it is not a positive integer
1 Like

Your code fails int he following test case:

10 1

Your Output

You have to print a positive number and leading zeroes are not allowed. Thus 0 is not a right answer.

The problem is that whenever the last digit of difference is 9 you are changing it to 0. But when the difference = 9, the answer becomes 0 which is not accepted.

1 Like

because 0 is not a positive number. It is the edge test case. @vijju123

Yes, I jsut figured that out. Although his algo and logic is nice as well.

1 Like

Nice spotting dear!! :slight_smile: