Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    3309 - Maximum Possible Number by Binary Concatenation.

    Medium

    You are given an array of integers nums of size 3.

    Return the maximum possible number whose binary representation can be formed by concatenating the binary representation of all elements in nums in some order.

    Note that the binary representation of any number does not contain leading zeros.

    Example 1:

    Input: nums = 1,2,3

    Output: 30

    Explanation:

    Concatenate the numbers in the order [3, 1, 2] to get the result "11110", which is the binary representation of 30.

    Example 2:

    Input: nums = 2,8,16

    Output: 1296

    Explanation:

    Concatenate the numbers in the order [2, 8, 16] to get the result "10100010000", which is the binary representation of 1296.

    Constraints:

    • nums.length == 3

    • 1 <= nums[i] <= 127

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer maxGoodNumber(IntArray nums)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait