title: Find Whether A Given Number Is A Power Of 4 Or Not 1
signature: def findWhetherAGivenNumberIsAPowerOf4OrNot1(n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Boolean , expected: Boolean): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(n: Int, expected: Boolean): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        1, 
        true    
      )}")   
  
  
      println(s"TEST-1...${driver(
        4, 
        true    
      )}")   
  
  
      println(s"TEST-2...${driver(
        64, 
        true    
      )}")   
  
  
      println(s"TEST-3...${driver(
        -64, 
        false    
      )}")   
  
  
      println(s"TEST-4...${driver(
        128, 
        false    
      )}")   
  
  
      println(s"TEST-5...${driver(
        1024, 
        true    
      )}")   
  
  
      println(s"TEST-6...${driver(
        45, 
        false    
      )}")   
  
  
      println(s"TEST-7...${driver(
        33, 
        false    
      )}")   
  
  
      println(s"TEST-8...${driver(
        66, 
        false    
      )}")   
  
  
      println(s"TEST-9...${driver(
        74, 
        false    
      )}")   
  
  }
  
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;
  }