Practice Sort Integers by The Power Value
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
The power of x is the number of operations needed to reach 1: replace an even x with x / 2, and an odd x with 3 * x + 1. Sort the integers in the inclusive interval [lo, hi] by increasing power, breaking ties by increasing integer value. Return the kth value in this order, with k counted from 1. Every input value is guaranteed to reach 1, and its power fits in a 32-bit signed integer.
Source: Sort Integers by The Power Value on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
lo = 12, hi = 15, k = 2
13
# Example 2
lo = 7, hi = 11, k = 4
7
Constraints
Related LeetCode Problems
Practice more problems similar to Sort Integers by The Power Value.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.