You are viewing a single comment's thread. Return to all comments →
C solution
int marsExploration(char* s) { int change =0 , i , j ; char arr[3] = {0} ; for (i=0 ;s[i];i+=3) { if (s[i]=='S') { arr[0] = 1 ; } if (s[i+1]=='O') { arr[1] = 1 ; } if (s[i+2]=='S') { arr[2] = 1 ; } for (j=0;j<3;j++) { if (arr[j]==0) { change++; } } for (j=0;j<3;j++) { arr[j] = 0 ; } } return change ; }
Seems like cookies are disabled on this browser, please enable them to open this website
Mars Exploration
You are viewing a single comment's thread. Return to all comments →
C solution