title: Decimal Binary Conversion Without Using Arithmetic Operators
signature: function decimal_binary_conversion_without_using_arithmetic_operators(n)
source_py: def decimal_binary_conversion_without_using_arithmetic_operators(n):
      if (n == 0):
          return '0'
      bin = ''
      while (n > 0):
          if ((n & 1) == 0):
              bin = ('0' + bin)
          else:
              bin = ('1' + bin)
          n = (n >> 1)
      return bin
source_cpp: string decimal_binary_conversion_without_using_arithmetic_operators(int n) {
    if ( n == 0 ) return "0";
    string bin = "";
    while ( n > 0 ) {
      bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin;
      n >>= 1;
    }
    return bin;
  }
question_info.entry_fn_name: decimal_binary_conversion_without_using_arithmetic_operators
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(35, "100011")
      print(string.format("TEST-0...%s",result))
  
      result = driver(17, "10001")
      print(string.format("TEST-1...%s",result))
  
      result = driver(8, "1000")
      print(string.format("TEST-2...%s",result))
  
      result = driver(99, "1100011")
      print(string.format("TEST-3...%s",result))
  
      result = driver(57, "111001")
      print(string.format("TEST-4...%s",result))
  
      result = driver(39, "100111")
      print(string.format("TEST-5...%s",result))
  
      result = driver(99, "1100011")
      print(string.format("TEST-6...%s",result))
  
      result = driver(14, "1110")
      print(string.format("TEST-7...%s",result))
  
      result = driver(22, "10110")
      print(string.format("TEST-8...%s",result))
  
      result = driver(7, "111")
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": "100011", "inputs": {"n": 35}}, {"idx": 1, "outputs": "10001", "inputs": {"n": 17}}, {"idx": 2, "outputs": "1000", "inputs": {"n": 8}}, {"idx": 3, "outputs": "1100011", "inputs": {"n": 99}}, {"idx": 4, "outputs": "111001", "inputs": {"n": 57}}, {"idx": 5, "outputs": "100111", "inputs": {"n": 39}}, {"idx": 6, "outputs": "1100011", "inputs": {"n": 99}}, {"idx": 7, "outputs": "1110", "inputs": {"n": 14}}, {"idx": 8, "outputs": "10110", "inputs": {"n": 22}}, {"idx": 9, "outputs": "111", "inputs": {"n": 7}}]