FastPrepPower of Two Without Division
Problems/Power of Two Without Division

Power of Two Without Division

Arm logoArm● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Arm intern phone screen. The report gives the yes-or-no task and bans division and Math.pow. It does not say how to handle signed edge cases or the range of numbers. We chose those. Our version is about 94% the same as the reported question.

Given a signed integer n, determine whether it is a positive power of two.

A positive integer is a power of two when it can be written as 2^k for an integer k >= 0. Your solution must not use division or a library exponentiation helper such as Math.pow.

Return true when n is a power of two and false otherwise.

Function

isPowerOfTwo(n: int) → boolean

Examples

Example 1

n = 16return = true

16 = 2^4, so the result is true.

Example 2

n = 18return = false

18 is positive but cannot be written as a single power of two.

Example 3

n = 1return = true

1 = 2^0, so it is a power of two.

Constraints

  • -2^31 <= n <= 2^31 - 1.
  • 1 counts as a power of two.
  • Every value less than or equal to 0 returns false.
  • The solution must not use division or a library exponentiation helper.

More Arm interview questions

  • Count Targets Formed by K Consecutive Positive IntegersOA · Seen Aug 2026
  • Triple-Position Alphabet EncodingOA · Seen Aug 2026

Similar questions at other companies

  • Count the 1 Bits in a 32-Bit ValueAmazon · PHONE SCREEN
  • Even or Odd Without DivisionAdobe · PHONE SCREENAdobe interview questions
  • Powers of Two in a RangeAkuna Capital · PHONE SCREENAkuna Capital interview questions
  • Choose the Next Minesweeper ActionRunloop · PHONE SCREEN
  • IP Address to CIDR BlocksOpenAI · PHONE SCREENOpenAI interview questions
  • Uniform Random Number from Coin TossesPatreon · PHONE SCREENPatreon interview questions
  • Fewest Games to Find the Top Two TeamsSusquehanna International Group (SIG) · PHONE SCREENSusquehanna International Group (SIG) interview questions
  • IP Range to CIDR BlocksAirbnb · PHONE SCREENAirbnb interview questions
  • Minimum Testers to Find the Poisoned BottleWalleye Capital · OA
  • Address on Same PageNVIDIA · OANVIDIA interview questions
See Arm hiring insights
Saved
class Solution {
    public boolean isPowerOfTwo(int n) {
        // write your code here
    }
}
Checking account…