프로그래머스 - 이진 변환 반복하기
part16. 이진 변환 반복하기
js ver 1.0
function solution(s) {
let delemination = 0, trans = 0, cnt = 0;
while(s != 1){
delemination += s.replace(/1/g, '').length;
trans = s.replace(/0/g, '').length;
s = trans.toString(2);
cnt++;
}
return [cnt, delemination];
}