title: Count Set Bits In An Integer
signature: count_set_bits_in_an_integer <- 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(
          58L, 
          4L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          92L, 
          4L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          73L, 
          3L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          52L, 
          3L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          24L, 
          2L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          14L, 
          3L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          58L, 
          4L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          11L, 
          3L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          8L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          52L, 
          3L
      )))
  
  }
  
  main()
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;
  }