3
int largestInteger(int num) {4
priority_queue<int> p; // priority queue to store odd digits in descending order5
priority_queue<int> q; // priority queue to store even digits in descending order6
string nums = to_string(num); // converting num to a string for easy access of the digits7
int n = nums.size(); // n stores the number of digits in num9
for (int i = 0; i < n; i++) {10
int digit = nums[i] - '0';11
if ((digit) % 2) // if digit is odd, push it into priority queue p14
q.push(digit); // if digit is even, push it into priority queue q18
for (int i = 0; i < n; i++) {20
if ((nums[i] - '0') % 2) // if the digit is odd, add the largest odd digit21
// of p into the answer28
} // if the digit is even, add the largest even digit of q into the answer