Problem:
Define a word as a sequence of consecutive English letters. Find the longest word from the given string.
Example
For text = "Ready, steady, go!", the output should be
longestWord(text) = "steady".
-Summary-
1. loop through the text and keep add until it meets a special character.
2. Once it encounters a special character, append the saved word to the temp_list.
3. For the last word that did not encounter any special character, add that word to temp_list as well.
4. find the max length word and return.
모든 문제에 대한 저작권은 CodeSignal 회사에 있습니다. [Copyright © 2020 BrainFights Inc. All rights reserved]
'CodeSignal > Arcade' 카테고리의 다른 글
CodeSignal [54/60] sumUpNumbers (0) | 2020.05.28 |
---|---|
CodeSignal [53/60] validTime (0) | 2020.05.28 |
CodeSignal [51/60] deleteDigit (0) | 2020.05.28 |
CodeSignal [50/60] chessKnight (0) | 2020.05.28 |
CodeSignal [49/60] lineEncoding (0) | 2020.05.27 |
댓글