title: Find Whether A Given Number Is A Power Of 4 Or Not 2
signature: func findWhetherAGivenNumberIsAPowerOf4OrNot2(n int) bool {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual bool, expected bool) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected bool) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(1, true)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(4, true)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(64, true)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(-64, false)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(128, false)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(1024, true)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(97, false)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(86, false)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(14, false)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(99, false)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def find_whether_a_given_number_is_a_power_of_4_or_not_2(n):
      return ((n != 0) and ((n & (n - 1)) == 0) and (not (n & 2863311530)))
source_cpp: bool find_whether_a_given_number_is_a_power_of_4_or_not_2(unsigned int n) {
    return n != 0 && ( ( n & ( n - 1 ) ) == 0 ) && ! ( n & 0xAAAAAAAA );
  }