title: Check Array Contains Contiguous Integers Duplicates Allowed
signature: fun checkArrayContainsContiguousIntegersDuplicatesAllowed(arr: ArrayList<Int>, n: Int): Boolean {
source_py: def check_array_contains_contiguous_integers_duplicates_allowed(arr, n):
      max1 = max(arr)
      min1 = min(arr)
      m = ((max1 - min1) + 1)
      if (m > n):
          return False
      visited = ([0] * m)
      for i in range(0, n):
          visited[(arr[i] - min1)] = True
      for i in range(0, m):
          if (visited[i] == False):
              return False
      return True
source_cpp: bool check_array_contains_contiguous_integers_duplicates_allowed(vector<int> arr, int n) {
    int max = * max_element(arr.begin(), arr.end());
    int min = * min_element(arr.begin(), arr.end());
    int m = max - min + 1;
    if ( m > n ) return false;
    bool visited [ m ];
    memset ( visited, false, sizeof ( visited ) );
    for ( int i = 0;
    i < n;
    i ++ ) visited [ arr [ i ] - min ] = true;
    for ( int i = 0;
    i < m;
    i ++ ) if ( visited [ i ] == false ) return false;
    return true;
  }
question_info.test_list: [{"idx": 0, "outputs": false, "inputs": {"arr": [2, 4, 19, 25, 65, 72, 75, 83, 90, 92], "n": 8}}, {"idx": 1, "outputs": false, "inputs": {"arr": [46, 2, 28, -44, 74, -36, -8, 30, -96, 60, 52, -58, 16, -38, 78, 38, -28, 16, 26, -42, 48, 40, 6, 72], "n": 14}}, {"idx": 2, "outputs": true, "inputs": {"arr": [0, 1, 1, 1], "n": 2}}, {"idx": 3, "outputs": false, "inputs": {"arr": [50, 21, 9, 29, 86, 2, 82, 49, 34, 18, 77, 83, 44, 67, 85, 58, 15, 85, 22, 3, 39, 67, 42, 37, 6, 35, 18, 57, 41, 32, 39, 30, 41, 68, 84, 36, 64, 36], "n": 23}}, {"idx": 4, "outputs": false, "inputs": {"arr": [-92, -82, -80, -78, -66, -66, -62, -58, -54, -52, -48, -30, -26, -22, -20, -20, -18, -14, -2, 12, 20, 24, 26, 26, 28, 28, 32, 36, 42, 48, 50, 52, 56, 64, 70, 72, 72, 80, 82, 84, 86, 92], "n": 26}}, {"idx": 5, "outputs": true, "inputs": {"arr": [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], "n": 43}}, {"idx": 6, "outputs": false, "inputs": {"arr": [18, 19, 21, 23, 30, 33, 38, 40, 45, 56, 63, 68, 93, 96], "n": 8}}, {"idx": 7, "outputs": false, "inputs": {"arr": [20, -90, -42, 48, 18, -46, 82, -12, -88, 82, 62, 24, 20, 64, -68, -34, -38, 8, -54, -20, -92, 34, -90, 78, 18, 8, -6, 10, 98, -24, 72, -92, 76, -22, 12, -44, 2, 68, -72, 42, 34, 20, -48], "n": 34}}, {"idx": 8, "outputs": true, "inputs": {"arr": [0, 0, 0, 0, 0, 1, 1, 1, 1], "n": 8}}, {"idx": 9, "outputs": false, "inputs": {"arr": [81, 25, 50, 48, 35, 38, 49, 21, 47, 94, 94, 55, 23, 45, 92, 23, 93, 33, 64, 9, 90, 64, 81, 17, 2, 73, 8, 7, 35, 36, 72], "n": 27}}]
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:Boolean, expected:Boolean):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, n: Int, expected:Boolean):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(2, 4, 19, 25, 65, 72, 75, 83, 90, 92), 8, false)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(46, 2, 28, -44, 74, -36, -8, 30, -96, 60, 52, -58, 16, -38, 78, 38, -28, 16, 26, -42, 48, 40, 6, 72), 14, false)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 1, 1, 1), 2, true)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(50, 21, 9, 29, 86, 2, 82, 49, 34, 18, 77, 83, 44, 67, 85, 58, 15, 85, 22, 3, 39, 67, 42, 37, 6, 35, 18, 57, 41, 32, 39, 30, 41, 68, 84, 36, 64, 36), 23, false)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-92, -82, -80, -78, -66, -66, -62, -58, -54, -52, -48, -30, -26, -22, -20, -20, -18, -14, -2, 12, 20, 24, 26, 26, 28, 28, 32, 36, 42, 48, 50, 52, 56, 64, 70, 72, 72, 80, 82, 84, 86, 92), 26, false)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0), 43, true)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(18, 19, 21, 23, 30, 33, 38, 40, 45, 56, 63, 68, 93, 96), 8, false)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(20, -90, -42, 48, 18, -46, 82, -12, -88, 82, 62, 24, 20, 64, -68, -34, -38, 8, -54, -20, -92, 34, -90, 78, 18, 8, -6, 10, 98, -24, 72, -92, 76, -22, 12, -44, 2, 68, -72, 42, 34, 20, -48), 34, false)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 1, 1, 1, 1), 8, true)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(81, 25, 50, 48, 35, 38, 49, 21, 47, 94, 94, 55, 23, 45, 92, 23, 93, 33, 64, 9, 90, 64, 81, 17, 2, 73, 8, 7, 35, 36, 72), 27, false)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: checkArrayContainsContiguousIntegersDuplicatesAllowed
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