You are viewing a single comment's thread. Return to all comments →
Java 8:
public static int marsExploration(String s) { String sos = "SOS"; int totalChangedLetters = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) != sos.charAt(i % 3)) { totalChangedLetters++; } } return totalChangedLetters; }
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 →
Java 8: