title: Program To Check If A Given Number Is Lucky All Digits Are Different
signature: class Solution {
  
      public Integer programToCheckIfAGivenNumberIsLuckyAllDigitsAreDifferent(Integer n) {
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.extension: java
question_info.entry_fn_name: programToCheckIfAGivenNumberIsLuckyAllDigitsAreDifferent
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(474, 0);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(9445, 0);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(90, 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(30, 0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(37453, 0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(27, 0);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(2400, 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(98, 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(46, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(722, 0);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__