You are given a non-negative integer n and a digit d. Your task is to return the number formed by removing every occurrence of d, while preserving the order of the remaining digits.
If removing the digit leaves leading zeros, they should not appear in the final number. If all digits are removed, return 0.
Input: n = 12321, d = 2
Output: 131
Explanation: Removing both occurrences of 2 leaves the digits 1, 3, and 1.
Input: n = 5005, d = 0
Output: 55
Explanation: Removing both occurrences of 0 leaves the digits 5 and 5.
Input: n = 1234, d = 9
Output: 1234
Explanation: The digit 9 does not appear in the number, so the original number remains unchanged.
Sign in to write, run, and submit your solution against the full test suite.