Answers for "Utopian Tree hackerrank solution in javascript"

0

Utopian Tree hackerrank solution in javascript

// Utopian Tree hackerrank solution in javascript
function utopianTree(n) {
    // Write your code here
    let cycle = 1;
    let height = 1;
    for(cycle; cycle<=n; cycle++){
        if(cycle %2 !== 0){
            height *= 2;
        }else{
            height++;
        }
    }
    return height;
}
Posted by: Guest on January-04-2022

Code answers related to "Utopian Tree hackerrank solution in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language