• + 0 comments
    long strangeCounter(long t) {
        long sum =3, counter = 3;
        while(sum < t){
            counter = counter*2;
            sum += counter;
        }
        
        return sum - t + 1;
    }