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

 

bryce.hulett@hotmail.com > closestDistance
prev  |  next  |  chance

Given a list of Integers in the following format x1, y1, x2, y2, x3, y3,...xN, yN for some N Cartesian points, find the closest distance between any two points. To avoid round off-error, round all answers to 4 significant digits. So a call to closestDistance([0,0,0,4]) would return 4.0 because the distance between point one(0,0) and point two(0,4) is 4.0.


closestDistance([0, 0, 0, 4]) → 4.0
closestDistance([50, 30, -10, -99, 0, 0, 1, 1]) → 1.4142
closestDistance([33, 11, 44, 88, -2, 9, 23, 45]) → 35.0571

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

public double closestDistance(List<Integer> list){ }

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: 200 Post-solution available

Copyright Nick Parlante 2017 - privacy