My issue
My solution is exactly matching with the Sample 1 test case and the code is also running fine with no errors. But while submitting, it is not even passing single test case there. Why is that so ?
My code
#include <iostream>
using namespace std;
int findMin(int a, int b){
int count = 0;
if (a % b == 0)
return 0;
else {
while (a % b != 0){
count++;
b--;
a++;
}
}
return count;
}
int main() {
int t;
cin >> t;
while (t--){
int a, b, ans = 0;
cin >> a >> b;
ans = findMin(a, b);
cout << ans << endl;
}
return 0;
}
Problem Link: Marbles Practice Coding Problem - CodeChef