Minimize XOR Value

Given two positive integers num1 and num2, find the integer x that has the same number of set bits as num2 and minimizes x XOR num1. If multiple candidates exist, return the smallest x.

Examples
Input: [3,5]
Output: 3
Hints

Minimize XOR Value

Given two positive integers num1 and num2, find the integer x that has the same number of set bits as num2 and minimizes x XOR num1. If multiple candidates exist, return the smallest x.