Didn't understood why these test cases 3,4 are failing . The code is working properly

Change data Type int to long
try for this input
99999993
correct output :
4999999300000024 4999999300000025

for input 1 output should be -1 .add this:

if(n==1 || n==0){
	 System.out.println(-1);
          return;
  }

for inputs which I can calculate its showing the correct answer but for 99999993 its showing 237459736 ,237459737. Rest all conditions fulfilled.

yes, change int to long and add condition for n=1 .if it still doesnt pass let me know :slight_smile:

still case 3, case 4 failed

can you please make me understand what’s wrong here?