← ALL NOTES
Greedy

2429. Minimize XOR

Given num1 and num2, find x that has the same number of set bits as num2 and minimizes x ^ num1. To minimize x ^ num1, x should match num1 in the high bits as much as possible, while carrying the…

Loading…