I was solving a problem from Leetcode https://leetcode.com/problems/count-pairs-of-points-with-distance-k/
In this problem i am only checking from (i to i+100) and it passed , i not have any proof how pair will exist only till i+100,can anyone provide any proof or intuition.
considering x1<=x2 (x1^x2)>=(x2-x1) (x1^x2)<=k (x2-x1)<=k x2<=x1+k
in case x2 is greater than x1+k then (x1^x2)>k and hence (x1^x2)+(y1^y2)>k
Because value of k <= 100
My submission — https://leetcode.com/submissions/detail/1051139486/
can you prove it, like we have (x,y) and (x+51,y+51) there xor will never exceed 100
xor of any two number is always greater than or equal to their absolute difference
Okay