title: Write One Line C Function To Find Whether A No Is Power Of Two
signature: class Solution {
  
      public Boolean writeOneLineCFunctionToFindWhetherANoIsPowerOfTwo(Integer n) {
source_py: def write_one_line_c_function_to_find_whether_a_no_is_power_of_two(n):
      if (n == 0):
          return False
      while (n != 1):
          if ((n % 2) != 0):
              return False
          n = (n // 2)
      return True
source_cpp: bool write_one_line_c_function_to_find_whether_a_no_is_power_of_two(int n) {
    if ( n == 0 ) return 0;
    while ( n != 1 ) {
      if ( n % 2 != 0 ) return 0;
      n = n / 2;
    }
    return 1;
  }
question_info.extension: java
question_info.entry_fn_name: writeOneLineCFunctionToFindWhetherANoIsPowerOfTwo
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"n": 1}}, {"idx": 1, "outputs": true, "inputs": {"n": 2}}, {"idx": 2, "outputs": true, "inputs": {"n": 8}}, {"idx": 3, "outputs": true, "inputs": {"n": 1024}}, {"idx": 4, "outputs": false, "inputs": {"n": 24}}, {"idx": 5, "outputs": false, "inputs": {"n": 7}}, {"idx": 6, "outputs": false, "inputs": {"n": 46}}, {"idx": 7, "outputs": false, "inputs": {"n": 61}}, {"idx": 8, "outputs": false, "inputs": {"n": 73}}, {"idx": 9, "outputs": false, "inputs": {"n": 66}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(1, true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(2, true);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(8, true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(1024, true);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(24, false);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(7, false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(46, false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(61, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(73, false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(66, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__