• + 0 comments

    function getMaxLessThanK(n, k) {

    var out_max = 0;
    var out = 0;
    
    for (let i=1; i < n; i++) {
        for (let j=0; j < (n-i); j++) {
            out = i & (i+1)+j; // think of a=i and b=(i+1)+j
            if (out < k && out > out_max) {
                out_max = out;
            }
        }
    }
    return out_max;
    

    }