Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Mars Exploration problem in js

Please refer this link for problem statement click here
 


    function marsExploration(message) {
        let sos = "SOS";
        let count = 0;
        for (let i = 0; i < message.length; i++) {
            if (message.charAt(i) != sos.charAt(i % 3)) count++;
        }
        return count;
    }
Source by www.codeforjs.com #
 
PREVIOUS NEXT
Tagged: #Mars #Exploration #problem #js
ADD COMMENT
Topic
Name
3+7 =