title: Smallest Power Of 2 Greater Than Or Equal To N 1
signature: smallestPowerOf2GreaterThanOrEqualToN1(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          31, 
          32)
      }");
  
      print("TEST-1...${driver(
          89, 
          128)
      }");
  
      print("TEST-2...${driver(
          92, 
          128)
      }");
  
      print("TEST-3...${driver(
          66, 
          128)
      }");
  
      print("TEST-4...${driver(
          38, 
          64)
      }");
  
      print("TEST-5...${driver(
          34, 
          64)
      }");
  
      print("TEST-6...${driver(
          17, 
          32)
      }");
  
      print("TEST-7...${driver(
          24, 
          32)
      }");
  
      print("TEST-8...${driver(
          54, 
          64)
      }");
  
      print("TEST-9...${driver(
          20, 
          32)
      }");
  
      return 0;
  }
source_py: def smallest_power_of_2_greater_than_or_equal_to_n_1(n):
      p = 1
      if (n and (not (n & (n - 1)))):
          return n
      while (p < n):
          p <<= 1
      return p
source_cpp: unsigned int smallest_power_of_2_greater_than_or_equal_to_n_1(unsigned int n) {
    unsigned int p = 1;
    if ( n && ! ( n & ( n - 1 ) ) ) return n;
    while ( p < n ) p <<= 1;
    return p;
  }