869. Reordered Power of 2 LeetCode Solution | Easy Approach

Minimum Cost to Merge Stones
Share:

Reordered Power of 2 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

Reordered Power of 2 Solutions

Time: O(n)
Space: O(n)

C++

 Will be updated Soon

Java

 
 Will be updated Soon

Python

  Will be updated Soon

Watch Tutorial

Checkout more Solutions here

Leave a Comment

Your email address will not be published. Required fields are marked *

x