Perf-test-5 is failing

I am Failing Perf test case 5, but the error is not timeout
first I am sorting each ArrayList of registration numbers
I am using the two-pointer approach for finding the number of people that can take an alternate ride
For finding the difference between two registration numbers, I am converting them into numbers
Can someone give me any hint? @virali-crio-ta, @Sumanth_Uppala

Hint 1: Check for string to number conversion.
Hint 2: Are you following the below stategy for 2 pointer approach?

Let’s say your cur_good car is x_i and cur_bad_car is y_j.
If abs(x_i - y_j) > required_distance
then, check if abs[x_(i+1)-y_j] < abs[x_i - y_(j+1)] then increase the pointer of good car else increase the pointer of bad car.

I checked many different types of test cases, that working fine for the conversion, It also passes 10 test cases out of 11, so I think there is no error in conversion, otherwise you can check my code.

for handling the second case, because the car registration numbers are in the sorted order, so I am doing this

if (abs(i_bad - j_good) > required_distance){
if (i_bad - j_good < 0){
} else{

There is any wrong in the above condition.

Same test case failing for me. Didn’t get this hint 2. Please explain more.

Try this test case:
1 50
KA01MQ9999 7
KA01MP9000 5 10
KA01MR0005 5 7

It’s giving the output: 2
output is correct or wrong.

Yes, the answer is correct.

Same output given by my code.

Assessment Successful. It was a minor typo mistake. :smile:

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.