LeetCode 869, Medium. Topics: Hash Table, Math, Sorting, Counting, Enumeration. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 36 parametrized pytest cases, and a playground notebook:
Problem
You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero.
Return true if and only if we can do this so that the resulting number is a power of two.
Examples
Constraints
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
Last modified on September 7, 2026