Class Solution

java.lang.Object
g0801_0900.s0869_reordered_power_of_2.Solution

public class Solution extends java.lang.Object
869 - Reordered Power of 2.

Medium

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.

Example 1:

Input: n = 1

Output: true

Example 2:

Input: n = 10

Output: false

Constraints:

  • 1 <= n <= 109
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • reorderedPowerOf2

      public boolean reorderedPowerOf2(int n)