title: Find Whether A Given Number Is A Power Of 4 Or Not 1
signature: find_whether_a_given_number_is_a_power_of_4_or_not_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(
          1L, 
          TRUE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          4L, 
          TRUE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          64L, 
          TRUE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          -64L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          128L, 
          FALSE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          1024L, 
          TRUE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          45L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          33L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          66L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          74L, 
          FALSE
      )))
  
  }
  
  main()
source_py: def find_whether_a_given_number_is_a_power_of_4_or_not_1(n):
      count = 0
      if (n and (not (n & (n - 1)))):
          while (n > 1):
              n >>= 1
              count += 1
          if ((count % 2) == 0):
              return True
          else:
              return False
source_cpp: bool find_whether_a_given_number_is_a_power_of_4_or_not_1(unsigned int n) {
    int count = 0;
    if ( n && ! ( n & ( n - 1 ) ) ) {
      while ( n > 1 ) {
        n >>= 1;
        count += 1;
      }
      return ( count % 2 == 0 ) ? 1 : 0;
    }
    return 0;
  }