'Java Server Side to find longest isogram from a list of strings
A client is sending a server a paragraph in the form of a list of string, each string is one line of the paragraph, number of lines, and an operation to do. Server side I need to find the longest isogram in the paragraph and return it to the client.
Here is what I have so far but I do not think it is correct:
public static String long_isogram(List<String> par){
int n = par.size();
String tempWordOne = "";
String tempWordTwo = "";
for (int i = 0; i < n; i++){
String[] arrOfStr = par.get(i).split(" ");
}
for (int i = 0; i < arrOfStr.size(); i++){
for (int j = 0; j < arrOfStr[i].length; j++){
for (int k = j + 1; k < arrOfStr[i].length; k++){
if (arrOfStr[i].charAt(j) != arrOfStr[i].charAt(k)){
tempWordOne = arrOfStr[i];
if(tempWordOne.length() > tempWordTwo.length()){
tempWordTwo = tempWordOne;
}
}
}
}
}
}//end long_isogram
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
