My issue
i have used a simple approach, i just reduced the apple or oranges till my money(k) got exhausted, i am failing on a hidden test case
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t; cin>>t;
while(t--){
int a,o,k;
cin>>a>>o>>k;
while(k--){
if(a>o) a--;
else o--;
}
cout<<abs(a-o)<<endl;
}
}
Problem Link: Chef and Fruits Practice Coding Problem