title: Next Power Of 2 1
signature: next_power_of_2_1 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          8L, 
          8L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          79L, 
          128L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          31L, 
          32L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          63L, 
          64L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          18L, 
          32L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          2L, 
          2L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          6L, 
          8L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          85L, 
          128L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          29L, 
          32L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          8L, 
          8L
      )))
  
  }
  
  main()
source_py: def next_power_of_2_1(n):
      p = 1
      if (n and (not (n & (n - 1)))):
          return n
      while (p < n):
          p <<= 1
      return p
source_cpp: unsigned int next_power_of_2_1(unsigned int n) {
    unsigned int p = 1;
    if ( n && ! ( n & ( n - 1 ) ) ) return n;
    while ( p < n ) p <<= 1;
    return p;
  }