• + 0 comments
    public static int getTotalX(List<Integer> a, List<Integer> b) {
        // Write your code here
        int first = a.get(a.size()-1), end = b.get(0);
        int count = 0;
        for(int start = first ; start<=end ; start += first){
          boolean status = true;
          for(int num : a){
            if(num>start || start%num!=0){
              status = false;
              break;
            }
          }
            if(status){
              for(int val : b){
                if(val<start || val%start!=0){
                  status = false;
                  break;
                }
              }
              if(status) count++;
            }
        }
        return count;
        }
    
    }