jhun
1
you are given a number N,you have to find the sum of f(i,j) for i starting from 1 to N and for each i, j starting from i to N.
ie;find from 1 to N Σ(from i to N Σf(i,j))
f(i,j)={ i*j if i&j =0, else 0}
here we’re given T test cases, 1<=T<=10 and 1<=N<=2*10^5
can you provide the question link
jhun
3
it was asked in a hiring contest. so unfortunately the question is not public.
1 Like
jhun
4
the first number j greater than i which will give i&j=0 is first power of 2 which is greater than i right?
1 Like
nichke
5
Here’s how I solved it today, hope you find it helpful.
1 Like