title: Number Indexes Equal Elements Given Range
signature: class Solution {
  
      public Integer numberIndexesEqualElementsGivenRange(ArrayList<Integer> a, Integer n, Integer l, Integer r) {
source_py: def number_indexes_equal_elements_given_range(a, n, l, r):
      count = 0
      for i in range(l, r):
          if (a[i] == a[(i + 1)]):
              count += 1
      return count
source_cpp: int number_indexes_equal_elements_given_range(vector<int> a, int n, int l, int r) {
    int count = 0;
    for ( int i = l;
    i < r;
    i ++ ) if ( a [ i ] == a [ i + 1 ] ) count += 1;
    return count;
  }
question_info.extension: java
question_info.entry_fn_name: numberIndexesEqualElementsGivenRange
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"a": [4, 13, 13, 16, 16, 19, 39, 41, 48, 52, 57, 62, 65, 67, 76, 84, 88, 91, 95, 96, 97, 98], "n": 18, "l": 12, "r": 17}}, {"idx": 1, "outputs": 0, "inputs": {"a": [62, 76, 86, -8, 84, -6, 72, 84, 6, -50, -18, -94, 54, 90, -74, -64, -26, -14, -32, 62, 10, 4, 70, -28, 8, 18, 4, -62, -76, 84, -78, -4, 84, 98, 58, -68, 42, -6, 34, -38, 52, -84, 78], "n": 32, "l": 38, "r": 23}}, {"idx": 2, "outputs": 0, "inputs": {"a": [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], "n": 10, "l": 6, "r": 6}}, {"idx": 3, "outputs": 0, "inputs": {"a": [11, 75, 98, 29, 62, 53, 48, 91, 86, 66, 48, 94], "n": 8, "l": 6, "r": 6}}, {"idx": 4, "outputs": 0, "inputs": {"a": [-94, -84, -70, -70, -40, -40, -36, -24, 10, 48, 62, 74], "n": 11, "l": 7, "r": 8}}, {"idx": 5, "outputs": 0, "inputs": {"a": [1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0], "n": 36, "l": 40, "r": 37}}, {"idx": 6, "outputs": 4, "inputs": {"a": [1, 2, 6, 7, 10, 11, 13, 19, 19, 25, 29, 30, 32, 34, 35, 45, 45, 46, 47, 48, 48, 53, 58, 61, 64, 65, 67, 75, 76, 81, 81, 84, 84, 85, 86, 94, 94, 96, 99], "n": 25, "l": 19, "r": 37}}, {"idx": 7, "outputs": 0, "inputs": {"a": [-56, 42, -34, -12, -86, 82, -96, -66, 30, 16, -40, 72, 84, 94, -48, -30, 26, 50, 42, -44, -50, 22, -38, 8, 34, 94, 2, 16, -32, 18, -58, 12, -26, 28, -62], "n": 21, "l": 30, "r": 26}}, {"idx": 8, "outputs": 0, "inputs": {"a": [0, 0, 0, 0, 1, 1, 1], "n": 4, "l": 5, "r": 5}}, {"idx": 9, "outputs": 0, "inputs": {"a": [6, 29], "n": 1, "l": 1, "r": 1}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(ArrayList<Integer> a, Integer n, Integer l, Integer r, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(a, n, l, r,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(new ArrayList<>(Arrays.asList(4, 13, 13, 16, 16, 19, 39, 41, 48, 52, 57, 62, 65, 67, 76, 84, 88, 91, 95, 96, 97, 98)), 18, 12, 17, 0);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(62, 76, 86, -8, 84, -6, 72, 84, 6, -50, -18, -94, 54, 90, -74, -64, -26, -14, -32, 62, 10, 4, 70, -28, 8, 18, 4, -62, -76, 84, -78, -4, 84, 98, 58, -68, 42, -6, 34, -38, 52, -84, 78)), 32, 38, 23, 0);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)), 10, 6, 6, 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(11, 75, 98, 29, 62, 53, 48, 91, 86, 66, 48, 94)), 8, 6, 6, 0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-94, -84, -70, -70, -40, -40, -36, -24, 10, 48, 62, 74)), 11, 7, 8, 0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0)), 36, 40, 37, 0);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 2, 6, 7, 10, 11, 13, 19, 19, 25, 29, 30, 32, 34, 35, 45, 45, 46, 47, 48, 48, 53, 58, 61, 64, 65, 67, 75, 76, 81, 81, 84, 84, 85, 86, 94, 94, 96, 99)), 25, 19, 37, 4);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-56, 42, -34, -12, -86, 82, -96, -66, 30, 16, -40, 72, 84, 94, -48, -30, 26, 50, 42, -44, -50, 22, -38, 8, 34, 94, 2, 16, -32, 18, -58, 12, -26, 28, -62)), 21, 30, 26, 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 1, 1, 1)), 4, 5, 5, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(6, 29)), 1, 1, 1, 0);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> a, Integer n, Integer l, Integer r, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(a, n, l, r),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__