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
|
1070 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can find the explanation here : https://youtu.be/Gf0fpGE83r4
Java 8 code
public static int findDifferentLetters(String s){ int count = 0; if(s.charAt(0)!='S'){ count++; } if(s.charAt(1)!='O'){ count++; } if(s.charAt(2)!='S'){ count++; } return count; }
public static int marsExploration(String s) { // Write your code here int ans = 0; // int count =0; for(int i =0;i
}
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
}
A short Python solution:
My Java solution: