Yugi
Help with optimisation
Hey guys:
Have this code here for the following requirements :
//“Have the function MyLongestString(string[] strings) take an array of strings and return the word that is the longest in length. If there are two or more words with equal length then return the first word. If the array is empty return the string -1”. I really don't like the double if statements I was thinking of using a HashMap but unsure on how to construct it, I mean this is fine but i want to improve. any advice would be great
//“Have the function MyLongestString(string[] strings) take an array of strings and return the word that is the longest in length. If there are two or more words with equal length then return the first word. If the array is empty return the string -1”. I really don't like the double if statements I was thinking of using a HashMap but unsure on how to construct it, I mean this is fine but i want to improve. any advice would be great
10 replies