CodeSignal/Arcade
CodeSignal [52/60] longestWord
벤진[Benzene]
2020. 5. 28. 06:11
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]