title: Count Set Bits In An Integer 1
signature: count_set_bits_in_an_integer_1 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          43L, 
          4L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          94L, 
          5L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          72L, 
          2L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          86L, 
          4L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          42L, 
          3L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          33L, 
          2L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          8L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          74L, 
          3L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          29L, 
          4L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          34L, 
          2L
      )))
  
  }
  
  main()
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 );
  }