We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Strings
- Mars Exploration
- Discussions
Mars Exploration
Mars Exploration
Sort by
recency
|
1079 Discussions
|
Please Login in order to post a comment
In c# public static int marsExploration(string s) { var correctMessage = string.Concat(Enumerable.Repeat("SOS",s.Length/3)); return correctMessage.Where((c, i) => c != s[i]).Count(); }
int marsExploration(char* s) { char* a = malloc(strlen(s)*sizeof(char)); strcpy(a,s); int count=0; for(int i=0;a[i]!='\0';i++){ if(a[i]!='S' && a[i]!='O') count++; } return count; } Why it is showing only some test cases are fail?
Here is my c++ solution
int marsExploration(string s) { int sz = s.size(); string strSos("SOS");
}
C Solution: