title: Check Array Contains Contiguous Integers Duplicates Allowed
signature: function checkArrayContainsContiguousIntegersDuplicatesAllowed(arr: Array<number>, n: number): 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.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: boolean, expected: boolean): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(arr: Array<number>, n: number, expected:boolean): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver([2, 4, 19, 25, 65, 72, 75, 83, 90, 92], 8, false);
    console.log(`TEST-0...${result}`);
  
    result = driver([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);
    console.log(`TEST-1...${result}`);
  
    result = driver([0, 1, 1, 1], 2, true);
    console.log(`TEST-2...${result}`);
  
    result = driver([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);
    console.log(`TEST-3...${result}`);
  
    result = driver([-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);
    console.log(`TEST-4...${result}`);
  
    result = driver([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);
    console.log(`TEST-5...${result}`);
  
    result = driver([18, 19, 21, 23, 30, 33, 38, 40, 45, 56, 63, 68, 93, 96], 8, false);
    console.log(`TEST-6...${result}`);
  
    result = driver([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);
    console.log(`TEST-7...${result}`);
  
    result = driver([0, 0, 0, 0, 0, 1, 1, 1, 1], 8, true);
    console.log(`TEST-8...${result}`);
  
    result = driver([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);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: checkArrayContainsContiguousIntegersDuplicatesAllowed
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