1class Solution {2 public int numberOfSteps(int num) {3 return helper(num, 0);4 }56 public int helper(int n, int c) {7 if (n == 0) return c;8 if (n % 2 == 0) { // check for even no.9 return helper(n / 2, c + 1);10 }1112 return helper(n - 1, c + 1);13 }14}
WPM •0 •0
ACC •0 •0
TIME •0