id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com lists > list_longestWord
prev  |  next  |  chance

Given a list of Strings, return the longest String that is in the list. If the list is empty, return an empty String. If multiple words are tied for the longest length, return the first word in the list with that length.


list_longestWord(["Hi", "Hello"]) → "Hello"
list_longestWord(["Comp", "Sci", "AP"]) → "Comp"
list_longestWord([]) → ""

...Save, Compile, Run (ctrl-enter)

public String list_longestWord(List<String> words) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy