Search
⌘K
Get Premium
Leetcode 2417. Closest Fair Integer
Given an integer N, find the nearest integer (by absolute difference, with usual tie-breaking) whose decimal representation has every digit occurring an even number of times — a "fair" integer. The task centers on constructing the closest number that satisfies digit-parity constraints, handling carries and possible length changes (solvable with digit-DP or greedy/backtracking over digits).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.