title: Program To Check If A Given Number Is Lucky All Digits Are Different
signature: fun programToCheckIfAGivenNumberIsLuckyAllDigitsAreDifferent(n: Int): Int {
source_py: def program_to_check_if_a_given_number_is_lucky_all_digits_are_different(n):
      ar = ([0] * 10)
      while (n > 0):
          digit = math.floor((n % 10))
          if ar[digit]:
              return 0
          ar[digit] = 1
          n = (n / 10)
      return 1
source_cpp: bool program_to_check_if_a_given_number_is_lucky_all_digits_are_different(int n) {
    bool arr [ 10 ];
    for ( int i = 0;
    i < 10;
    i ++ ) arr [ i ] = false;
    while ( n > 0 ) {
      int digit = n % 10;
      if ( arr [ digit ] ) return false;
      arr [ digit ] = true;
      n = n / 10;
    }
    return true;
  }
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"n": 474}}, {"idx": 1, "outputs": 0, "inputs": {"n": 9445}}, {"idx": 2, "outputs": 0, "inputs": {"n": 90}}, {"idx": 3, "outputs": 0, "inputs": {"n": 30}}, {"idx": 4, "outputs": 0, "inputs": {"n": 37453}}, {"idx": 5, "outputs": 0, "inputs": {"n": 27}}, {"idx": 6, "outputs": 0, "inputs": {"n": 2400}}, {"idx": 7, "outputs": 0, "inputs": {"n": 98}}, {"idx": 8, "outputs": 0, "inputs": {"n": 46}}, {"idx": 9, "outputs": 0, "inputs": {"n": 722}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(474, 0)
      println("TEST-0...${result}")
      
      result = driver(9445, 0)
      println("TEST-1...${result}")
      
      result = driver(90, 0)
      println("TEST-2...${result}")
      
      result = driver(30, 0)
      println("TEST-3...${result}")
      
      result = driver(37453, 0)
      println("TEST-4...${result}")
      
      result = driver(27, 0)
      println("TEST-5...${result}")
      
      result = driver(2400, 0)
      println("TEST-6...${result}")
      
      result = driver(98, 0)
      println("TEST-7...${result}")
      
      result = driver(46, 0)
      println("TEST-8...${result}")
      
      result = driver(722, 0)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: programToCheckIfAGivenNumberIsLuckyAllDigitsAreDifferent
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn