Start 31 XOR and AND TLE get stuck

So my idea is save all values in map with index array, the loop the original array, for each value, find the range[l, r] matches the xor < and (example 45, [32, 63]),

then get the lowest value(min) >= 32, largest value(max) <= 63 in treemap keys, and get the matched index array, find j > i, add to res.

Don’t know why continues TLE should be O(nlogn)

Hey @henrychen222 :wave: ,
Your code has Time complexity of O(nn). Because you are finding a range for a Xor but(test case where your code is failing) lets take a case where for every number you always need a range from 0 to N or may be less but for every element so there your code is running with O(nn) also with big numbers such as 10^9 your code is giving TLE.