← ALL NOTES
Array

1356. Sort Integers by The Number of 1 Bits

Sort by number of set bits ascending; ties broken by the value ascending. A composite comparator — (popcount, value) — expresses the two-level order directly in one sort.

Loading…