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

 

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

Given an array of integers in the following format x1, y1, x2, y2, x3, y3,...xN, yN for some N Cartesian points(where N >1), find the closest taxi cab distance between any two points. The taxi cab distance between two points is the sum of the absolute differences of their Cartesian coordinates. So for (0,0) and (3,4) a taxi would have to drive east 3 blocks and north 4 blocks for a total of 7 blocks.


taxi([0, 0, 0, 4]) → 4
taxi([0, 0, 3, 4, 17, 18]) → 7
taxi([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) → 4

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

public int taxi(int[] nums){ }

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