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

 

jebbert@volusia.k12.fl.us arrays > backToStart
prev  |  next  |  chance

The array "moves" contains a series of directions to move choosing from up, down, left, or right and moving exactly one space per move. backToStart returns true if the final move returns you to your starting location. You may cross through your starting location along the way, but do not return true unless your final move places you at your starting location. Return false if you do not end at the starting location.


backToStart(["down", "right", "down", "right", "up", "right", "left", "up", "left", "left"]) → true
backToStart(["down", "right", "down", "right", "up", "up", "left", "up", "left", "left"]) → false
backToStart(["down", "down", "down", "right", "down", "up", "down", "up", "left", "left"]) → false

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

public boolean backToStart(String[] directions) { }

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: 285

Copyright Nick Parlante 2017 - privacy