My issue
My code
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int> rem;
int i=1;
while(n--){
int x = n%i;
rem.push_back(x);
i++;
}
int max=*max_element(rem.begin(),rem.end());
int j=rem.size()-1;
while(rem[j]!=max){
j--;
}
cout<<j+1<<endl;
}
return 0;
}
Problem Link: MUFFINS3 Problem - CodeChef