Time Limit problem for simple question

Input is a number N in range 1 to 2 * 10^5

write a function

func(i,j) {
  if i & j == 0
    return i *j 
 else 
   return 0
}

and for given N

for each i=1 to N 
   for each j = i to N
	   result += func(i,j);
	   
	   
print result % 1000000007

I was hitting TLE when input is > 100000
Can someone show some tricks to lower the time? Can we get better than O(N^2) ?
P.S: I have not yet found similar question on leetcode. This was asked in Nokia Hiring In India on HackerEarth.

Comments (2)