about | help | code help+videos | done | prefs |
The powers of two are 1, 2, 4, 8, 16, 32, 64, and so on. Given a positive integer, find the smallest power of 2 that is greater than or equal to that integer. nextPowerOf2(47) → 64 nextPowerOf2(18) → 32 nextPowerOf2(31) → 32 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 120
Copyright Nick Parlante 2017 - privacy