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

 

orion.a.smith@gmail.com apcsa-arrays > apcsaArraysWinner
prev  |  next  |  chance

In a track meet, data is recorded as a single String containing pairs of (Name Time). For example: "Alice 12.5 Bob 14.2 Charlie 11.9". Given a String with that format, find the person with the fastest (lowest) lap time and return their name as a String.


HINTS

Doubles can be parsed much like integers, and the algorithm is similar: what has to change in order to get the "alternation" between names and numbers?

apcsaArraysWinner("Alice 12.5 Bob 14.2 Charlie 11.9") → "Charlie"
apcsaArraysWinner("Slow 20.0 Fast 10.0") → "Fast"
apcsaArraysWinner("Zoe 15.5") → "Zoe"

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

public String apcsaArraysWinner(String data) { }

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

Difficulty: 240

Copyright Nick Parlante 2017 - privacy