title: Count Set Bits In An Integer 3
signature: def countSetBitsInAnInteger3(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(
        6, 
        2    
      )}")   
  
  
      println(s"TEST-1...${driver(
        58, 
        4    
      )}")   
  
  
      println(s"TEST-2...${driver(
        90, 
        4    
      )}")   
  
  
      println(s"TEST-3...${driver(
        69, 
        3    
      )}")   
  
  
      println(s"TEST-4...${driver(
        15, 
        4    
      )}")   
  
  
      println(s"TEST-5...${driver(
        54, 
        4    
      )}")   
  
  
      println(s"TEST-6...${driver(
        60, 
        4    
      )}")   
  
  
      println(s"TEST-7...${driver(
        51, 
        4    
      )}")   
  
  
      println(s"TEST-8...${driver(
        46, 
        4    
      )}")   
  
  
      println(s"TEST-9...${driver(
        91, 
        5    
      )}")   
  
  }
  
source_py: def count_set_bits_in_an_integer_3(n):
      if (n == 0):
          return 0
      else:
          return (1 + count_set_bits_in_an_integer_3((n & (n - 1))))
source_cpp: int count_set_bits_in_an_integer_3(int n) {
    if ( n == 0 ) return 0;
    else return 1 + count_set_bits_in_an_integer_3 ( n & ( n - 1 ) );
  }