Find the minimum distance between two given words in linear time
1. Use two variables to keep track of the indexes of two words
2. Compute and Update the Minimum distance along the sentence
static int minimumDistance(String[] wordArray, String word1, String word2){
        int minDistance = Integer.MAX_VALUE;
        if(word1 != null && word2 != null){
            int index1 = -1;
            int index2 = -1;
            for(int i=0; i<wordArray.length; i++){
                if(word1.equals(wordArray[i]))
                    index1 = i; 
                
                if(word2.equals(wordArray[i]))
                    index2 = i;

                if(index1 != -1 && index2 != -1){
                    int dist = Math.abs(index1 - index2);
                    minDistance = Math.min(dist, minDistance);
                }
            }
        }
        return minDistance;
    }