My issue
Is it wrong?
please, i need justification?
include
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--) {
int n;
cin>>n;
string s;
cin>>s;
for(int i=0;i<n;++i) {
if(s[i]=='1') {
for(int j=i+1;j<n;++j) {
s[j]='0';
}
break;
}
}
cout<<s<<"\n";
}
return 0;
}
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--) {
int n;
cin>>n;
string s;
cin>>s;
for(int i=0;i<n;++i) {
if(s[i]=='1') {
for(int j=i+1;j<n;++j) {
s[j]='0';
}
break;
}
}
cout<<s<<"\n";
}
return 0;
}
Problem Link: S100 Problem - CodeChef