title: Decimal Binary Conversion Without Using Arithmetic Operators
signature: function decimalBinaryConversionWithoutUsingArithmeticOperators(n: number): string {
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.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}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: string, expected: string): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:string): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(35, "100011");
    console.log(`TEST-0...${result}`);
  
    result = driver(17, "10001");
    console.log(`TEST-1...${result}`);
  
    result = driver(8, "1000");
    console.log(`TEST-2...${result}`);
  
    result = driver(99, "1100011");
    console.log(`TEST-3...${result}`);
  
    result = driver(57, "111001");
    console.log(`TEST-4...${result}`);
  
    result = driver(39, "100111");
    console.log(`TEST-5...${result}`);
  
    result = driver(99, "1100011");
    console.log(`TEST-6...${result}`);
  
    result = driver(14, "1110");
    console.log(`TEST-7...${result}`);
  
    result = driver(22, "10110");
    console.log(`TEST-8...${result}`);
  
    result = driver(7, "111");
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: decimalBinaryConversionWithoutUsingArithmeticOperators
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js