Skip to content

Commit 6cfbc91

Browse files
committed
Runtime: 76 ms (Top 75.00%) | Memory: 41.8 MB (Top 89.58%)
1 parent 24d5990 commit 6cfbc91

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
// Runtime: 76 ms (Top 75.00%) | Memory: 41.8 MB (Top 89.58%)
12
/**
23
* @param {number} startValue
34
* @param {number} target
45
* @return {number}
56
*/
67
var brokenCalc = function(startValue, target) {
78
let steps = 0;
8-
9+
910
while(target !== startValue){
1011

1112
if(startValue > target){
12-
return steps + startValue - target;
13+
return steps + startValue - target;
1314
}
1415
if(target %2 === 0){
1516
target /= 2;
1617
}else {
1718
target += 1;
18-
19+
1920
}
2021
steps++;
2122
}
2223
return steps
23-
};
24+
};

0 commit comments

Comments
 (0)