about | help | code help+videos | done | prefs |
In a legacy system, directions are stored by magnitude followed by direction. Thus, "12E" represents " travel 12 kms towards east, "4N" represents 4kms to the north, "120S" represents 120 kms south and finally "3W" represents 3 kms towards west.
distanceFromHome(["10N", "10W", "10S", "10E"]) → 0.0 distanceFromHome(["10N", "10W", "10S", "8E"]) → 2.0 distanceFromHome(["8N", "6W"]) → 10.0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 4 Post-solution available
Copyright Nick Parlante 2017 - privacy