Tap here to switch tabs
Problem
Submissions

Problem: Lexicographically Largest Power Array

Try to solve the Lexicographically Largest Power Array problem.

Statement

You are given an integer array nums.

For any permutation perm of nums, an array power of size 1515 is defined such that for each index i from 00 to 1414, power[i] represents the length of the longest prefix of perm where every element has the bit at position (14−i)(14 - i) set to 11.

Return the lexicographically largest power array that can be obtained by choosing an optimal permutation perm.

An array a is lexicographically larger than an array b of the same length if, at the first index where they differ, array a contains a value strictly greater than the corresponding value in array b.

Constraints:

  • 1≤1 \leq nums.length ≤5imes104\leq 5 imes 10^4

  • 0≤0 \leq nums[i] <215< 2^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Lexicographically Largest Power Array

Try to solve the Lexicographically Largest Power Array problem.

Statement

You are given an integer array nums.

For any permutation perm of nums, an array power of size 1515 is defined such that for each index i from 00 to 1414, power[i] represents the length of the longest prefix of perm where every element has the bit at position (14−i)(14 - i) set to 11.

Return the lexicographically largest power array that can be obtained by choosing an optimal permutation perm.

An array a is lexicographically larger than an array b of the same length if, at the first index where they differ, array a contains a value strictly greater than the corresponding value in array b.

Constraints:

  • 1≤1 \leq nums.length ≤5imes104\leq 5 imes 10^4

  • 0≤0 \leq nums[i] <215< 2^{15}