title: Write A C Program To Find The Parity Of An Unsigned Integer
signature: def writeACProgramToFindTheParityOfAnUnsignedInteger(n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(n: Int, expected: Int): 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(
        63, 
        0    
      )}")   
  
  
      println(s"TEST-1...${driver(
        64, 
        -1    
      )}")   
  
  
      println(s"TEST-2...${driver(
        85, 
        0    
      )}")   
  
  
      println(s"TEST-3...${driver(
        36, 
        0    
      )}")   
  
  
      println(s"TEST-4...${driver(
        20, 
        0    
      )}")   
  
  
      println(s"TEST-5...${driver(
        63, 
        0    
      )}")   
  
  
      println(s"TEST-6...${driver(
        42, 
        -1    
      )}")   
  
  
      println(s"TEST-7...${driver(
        19, 
        -1    
      )}")   
  
  
      println(s"TEST-8...${driver(
        62, 
        -1    
      )}")   
  
  
      println(s"TEST-9...${driver(
        97, 
        -1    
      )}")   
  
  }
  
source_py: def write_a_c_program_to_find_the_parity_of_an_unsigned_integer(n):
      parity = 0
      while n:
          parity = (~ parity)
          n = (n & (n - 1))
      return parity
source_cpp: bool write_a_c_program_to_find_the_parity_of_an_unsigned_integer(unsigned int n) {
    bool parity = 0;
    while ( n ) {
      parity = ! parity;
      n = n & ( n - 1 );
    }
    return parity;
  }