Guys, in one of the question my code is passing 5/6 test cases. Is there any way that I can know that one case which my code is not able to follow.
Question - Check Permutation
// My code.
#include
#include
using namespace std;
bool isPermutation(char input1[], char input2[]) {
// Write your code here
if(strlen(input1) != strlen(input2)){
return 0;
}
for(int i = 0; i < input1[i] != 0; i++){
int flag = 0;
for(int j = 0; j < input2[j] != 0; j++){
if(input1[i] == input2[j]){
input2[j] = 'A';
flag = 1;
break;
}
}
if(!flag){
return 0;
}
}
return 1;
}
int main() {
int size = 1e6;
char str1[size];
char str2[size];
cin >> str1 >> str2;
cout << (isPermutation(str1, str2) ? “true” : “false”);
}