• + 0 comments
        public static long strangeCounter(long t) {
            long counter = 3;
            long seconds = 1;
            long start = 3;
            while (t > 1) {
                long interval = Math.min(counter, t-1);
                t -= interval;
                seconds += interval;
                counter -= interval;
                if (counter == 0) {
                    start = start * 2;
                    counter = start;   
                }
            }
            return counter;
        }