title: Find Whether A Given Number Is A Power Of 4 Or Not 1
signature: function findWhetherAGivenNumberIsAPowerOf4OrNot1(n: number): boolean {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"n": 1}}, {"idx": 1, "outputs": true, "inputs": {"n": 4}}, {"idx": 2, "outputs": true, "inputs": {"n": 64}}, {"idx": 3, "outputs": null, "inputs": {"n": -64}}, {"idx": 4, "outputs": false, "inputs": {"n": 128}}, {"idx": 5, "outputs": true, "inputs": {"n": 1024}}, {"idx": 6, "outputs": null, "inputs": {"n": 45}}, {"idx": 7, "outputs": null, "inputs": {"n": 33}}, {"idx": 8, "outputs": null, "inputs": {"n": 66}}, {"idx": 9, "outputs": null, "inputs": {"n": 74}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: boolean, expected: boolean): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:boolean): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(1, true);
    console.log(`TEST-0...${result}`);
  
    result = driver(4, true);
    console.log(`TEST-1...${result}`);
  
    result = driver(64, true);
    console.log(`TEST-2...${result}`);
  
    result = driver(-64, false);
    console.log(`TEST-3...${result}`);
  
    result = driver(128, false);
    console.log(`TEST-4...${result}`);
  
    result = driver(1024, true);
    console.log(`TEST-5...${result}`);
  
    result = driver(45, false);
    console.log(`TEST-6...${result}`);
  
    result = driver(33, false);
    console.log(`TEST-7...${result}`);
  
    result = driver(66, false);
    console.log(`TEST-8...${result}`);
  
    result = driver(74, false);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: findWhetherAGivenNumberIsAPowerOf4OrNot1
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js