var numSteps = function(s) {
let carry = 0
let steps = 0;
for (let i = s.length - 1; i > 0; i--) {
if (s.charAt(i) - '0' + carry == 1) {
carry = 1
steps += 2
} else {
steps++
}
}
return steps + carry
};
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)