Near or Far
Description:
The explorer Indian A. Junes is lost... Help him find the exit of the dungeon!
In his hand is a magical map of (n x m)
dimensions with coordinates (0, 0)
and (n-1, m-1)
as the top-left
and bottom-right
corners respectively. Not completely helpless while exploring, he recorded two points A
and B
that are equidistant to the exit. Now, you only need to find all possible exits from the map!
For example:
n = 4
m = 3
A = (1, 1)
B = (2, 2)
will be reflected into a 2D map, as:
[[* * * *]
[* A * *]
[* * B *]]
It can be seen that points (2, 1)
, (1, 2)
and (3, 0)
are equidistant to points A
and B
. which should be returned as a list of tuples sorted in increasing order of values
:
returned_value = [(1, 2), (2, 1), (3, 0)]
Constraints:
3 <= n,m <= 100
ans = List of tuples or empty list
Distances between points are measured in euclidean distances.
If you don't know euclidean distance formula, check here.
Note: There are cases where there are no coordinates equidistant to both points, don't expect to always have a common point!
Similar Kata:
Stats:
Created | Jan 17, 2021 |
Published | Jan 17, 2021 |
Warriors Trained | 421 |
Total Skips | 86 |
Total Code Submissions | 457 |
Total Times Completed | 129 |
Python Completions | 129 |
Total Stars | 4 |
% of votes with a positive feedback rating | 82% of 47 |
Total "Very Satisfied" Votes | 32 |
Total "Somewhat Satisfied" Votes | 13 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 36 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 8 kyu |