You are viewing a single comment's thread. Return to all comments →
My TypeScript solution:
function marsExploration(s: string): number { const length = s.length; let changedChars = 0; for (let i = 0; i < length; i++) { const originalChar = ( i % 3 === 0 || (i + 1) % 3 === 0 ) ? "S" : "O"; if (s[i] !== originalChar) changedChars ++; } return changedChars; }
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 →
My TypeScript solution: