private int findMax(Map<Double, Integer> map, int vertical, int horizonal, int dup){
        if(map.isEmpty()){
            max = Math.max(Math.max(vertical, horizonal),  dup + 1);
            return max;
        }

        for(int num : map.values()){
            max = Math.max(max, num + dup);
        }
        max = Math.max(Math.max(vertical, horizonal),  max);
        return max;
    }