title: Count Set Bits In An Integer
signature: def countSetBitsInAnInteger(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(
        58, 
        4    
      )}")   
  
  
      println(s"TEST-1...${driver(
        92, 
        4    
      )}")   
  
  
      println(s"TEST-2...${driver(
        73, 
        3    
      )}")   
  
  
      println(s"TEST-3...${driver(
        52, 
        3    
      )}")   
  
  
      println(s"TEST-4...${driver(
        24, 
        2    
      )}")   
  
  
      println(s"TEST-5...${driver(
        14, 
        3    
      )}")   
  
  
      println(s"TEST-6...${driver(
        58, 
        4    
      )}")   
  
  
      println(s"TEST-7...${driver(
        11, 
        3    
      )}")   
  
  
      println(s"TEST-8...${driver(
        8, 
        1    
      )}")   
  
  
      println(s"TEST-9...${driver(
        52, 
        3    
      )}")   
  
  }
  
source_py: def count_set_bits_in_an_integer(n):
      count = 0
      while n:
          count += (n & 1)
          n >>= 1
      return count
source_cpp: unsigned int count_set_bits_in_an_integer(unsigned int n) {
    unsigned int count = 0;
    while ( n ) {
      count += n & 1;
      n >>= 1;
    }
    return count;
  }