My code works fine for the test cases but getting TLE on submitting . plz tell me what is wrong with this code
You need fast I/O. Scanner is slow compared to other I/O classes.
Try using BufferedReader and InputStreamReader instead.
1 Like
it worked.