We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The word "lexicographic" in this problem statement is very misleading. The standard definition of lexicographic is that the numbers are compared to each other in an alphabetical sense, as if the numbers were strings ([https://en.wikipedia.org/wiki/Lexicographical_order]). So a lexicographic comparison is the same as a numerical comparison if either number is positive. However if both numbers are negative, the comparison reverses, since the string '-1' is less than the string '-5'.
The answer expected by the grader here is simply the minimum possible numerical value, for each dimension, that optimizes the total distance traveled.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Hyperspace Travel
You are viewing a single comment's thread. Return to all comments →
The word "lexicographic" in this problem statement is very misleading. The standard definition of lexicographic is that the numbers are compared to each other in an alphabetical sense, as if the numbers were strings ([https://en.wikipedia.org/wiki/Lexicographical_order]). So a lexicographic comparison is the same as a numerical comparison if either number is positive. However if both numbers are negative, the comparison reverses, since the string '-1' is less than the string '-5'.
The answer expected by the grader here is simply the minimum possible numerical value, for each dimension, that optimizes the total distance traveled.