title: Count Set Bits In An Integer
signature: countSetBitsInAnInteger(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          58, 
          4)
      }");
  
      print("TEST-1...${driver(
          92, 
          4)
      }");
  
      print("TEST-2...${driver(
          73, 
          3)
      }");
  
      print("TEST-3...${driver(
          52, 
          3)
      }");
  
      print("TEST-4...${driver(
          24, 
          2)
      }");
  
      print("TEST-5...${driver(
          14, 
          3)
      }");
  
      print("TEST-6...${driver(
          58, 
          4)
      }");
  
      print("TEST-7...${driver(
          11, 
          3)
      }");
  
      print("TEST-8...${driver(
          8, 
          1)
      }");
  
      print("TEST-9...${driver(
          52, 
          3)
      }");
  
      return 0;
  }
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;
  }