Here is the link for the problem with CodeChef problem Carvans.
Here's my solution. ... I am unable to find any bugs. Please help me debug it and tell me what is wrong with it.
#include <stdio.h>
#include <algorithm>
using namespace std;
void solve()
{
int previous_car_speed = 1e9, current_car_speed, number_of_cars, current_car_max_speed;;
scanf("%d", &number_of_cars);
int no_of_cars_at_max_speed = 0;
for(int i = 1; i <= number_of_cars; i++)
{
scanf("%d", ¤t_car_max_speed);
current_car_speed = min(previous_car_speed, current_car_max_speed);
no_of_cars_at_max_speed += (current_car_speed == current_car_max_speed);
previous_car_speed = current_car_speed;
}
printf("%d\n", no_of_cars_at_max_speed);
}
int main()
{
int no_of_test_cases;
scanf("%d", &no_of_test_cases);
while(no_of_test_cases--)
solve();
return 0;
}


