title: Count Set Bits In An Integer 1
signature: countSetBitsInAnInteger1(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(
          43, 
          4)
      }");
  
      print("TEST-1...${driver(
          94, 
          5)
      }");
  
      print("TEST-2...${driver(
          72, 
          2)
      }");
  
      print("TEST-3...${driver(
          86, 
          4)
      }");
  
      print("TEST-4...${driver(
          42, 
          3)
      }");
  
      print("TEST-5...${driver(
          33, 
          2)
      }");
  
      print("TEST-6...${driver(
          8, 
          1)
      }");
  
      print("TEST-7...${driver(
          74, 
          3)
      }");
  
      print("TEST-8...${driver(
          29, 
          4)
      }");
  
      print("TEST-9...${driver(
          34, 
          2)
      }");
  
      return 0;
  }
source_py: def count_set_bits_in_an_integer_1(n):
      if (n == 0):
          return 0
      else:
          return ((n & 1) + count_set_bits_in_an_integer_1((n >> 1)))
source_cpp: int count_set_bits_in_an_integer_1(int n) {
    if ( n == 0 ) return 0;
    else return ( n & 1 ) + count_set_bits_in_an_integer_1 ( n >> 1 );
  }