You are viewing a single comment's thread. Return to all comments →
C++ Solution with recurse:
long defRange(long t, long p, long it) { long b = (long)3*pow(2, it++) + p; if (t >= p && t < b) return b; else return defRange(t, b, it); } // res = -t * b[n] : b[n] = 3*pow(2,n) + b[n-1] long strangeCounter(long t) { long b = defRange(t, 1, 0); return -t+b; }
Seems like cookies are disabled on this browser, please enable them to open this website
Strange Counter
You are viewing a single comment's thread. Return to all comments →
C++ Solution with recurse: