A fleet-management system scales server clusters by doubling their node count during scale-out events. A cluster size n is called:
n is an exact power of four (n = 4^k for some integer k \ge 0),n is an exact power of two but is not a power of four,Note every power of four is automatically also a power of two, so quad tier takes priority.
Given n, print its classification.
Line 1: an integer n.
Print exactly one of the following strings: power-of-four, power-of-two, or neither.
Example 1
Input
16
Expected
power-of-four
Explanation
16 = 4^2, so it is a quad tier: power-of-four.
Example 2
Input
8
Expected
power-of-two
Explanation
8 = 2^3 is a power of two but not a power of four, so it is power-of-two.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →