title: Count Set Bits In An Integer 3
signature: countSetBitsInAnInteger3(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(
          6, 
          2)
      }");
  
      print("TEST-1...${driver(
          58, 
          4)
      }");
  
      print("TEST-2...${driver(
          90, 
          4)
      }");
  
      print("TEST-3...${driver(
          69, 
          3)
      }");
  
      print("TEST-4...${driver(
          15, 
          4)
      }");
  
      print("TEST-5...${driver(
          54, 
          4)
      }");
  
      print("TEST-6...${driver(
          60, 
          4)
      }");
  
      print("TEST-7...${driver(
          51, 
          4)
      }");
  
      print("TEST-8...${driver(
          46, 
          4)
      }");
  
      print("TEST-9...${driver(
          91, 
          5)
      }");
  
      return 0;
  }
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 ) );
  }