Javascript Solution


  • 0
    G

    var recurse = function(start, end, n, result) {
    for (var i = start; i <= end && i <= n; i++) {
    result.push(i);
    recurse(i * 10, i * 10 + 9, n, result);
    }
    };

    var lexicalOrder = function(n) {
    var result = [];
    recurse(1, 9, n, result);
    return result;
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.