Knight Travel Speed

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Given two chessboard positions as 0-indexed coordinate pairs, determine the minimum number of moves required for a knight to move from one square to the other. The knight's position may not exceed 0 <= x < 8 on either axis.

Options

exec is denied

rejudge feature is enabled

now post-mortem time, all source codes will be revealed

Sample input:_

((0, 0), (2, 1))
((0, 0), (2, 0))
((0, 0), (0, 1))

Sample output:

1
2
3

Sample input:_

((5, 5), (5, 6))
((4, 4), (5, 5))
((0, 0), (1, 1))

Sample output:

3
2
4

Sample input:_

((0, 0), (6, 6))
((0, 0), (0, 0))

Sample output:

4
0

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1mitchs250.03322017/11/10 03:39:080B / 17B / 8B
2rotary-o300.03332017/11/10 22:55:460B / 17B / 12B

Ruby2 _

RankUserSizeTimeDateStatistics
1mitchs250.15102017/11/10 03:46:180B / 17B / 8B
2rotary-o300.14632017/11/10 22:54:380B / 17B / 12B

Python _

RankUserSizeTimeDateStatistics
1mitchs350.07062017/11/10 05:36:530B / 26B / 8B
2llhuii350.07232017/11/17 23:40:300B / 25B / 9B
3rolf560.07092017/11/12 00:45:280B / 32B / 21B

Python3 _

RankUserSizeTimeDateStatistics
1llhuii360.11172017/11/18 02:06:520B / 25B / 10B
2mitchs370.11372017/11/12 23:34:440B / 26B / 10B
3Mr. Xcoder550.13102017/11/12 03:20:090B / 29B / 26B

C _

RankUserSizeTimeDateStatistics
1llhuii570.03122017/11/18 12:37:070B / 34B / 23B

Haskell _

RankUserSizeTimeDateStatistics
1henkma600.03272017/11/24 00:18:030B / 35B / 25B

sed _

RankUserSizeTimeDateStatistics
1tails270.03122017/11/16 02:16:560B / 11B / 11B
2mitchs270.03122017/11/21 02:41:470B / 11B / 11B

gs2 _

RankUserSizeTimeDateStatistics
1whio120.17192017/11/18 02:09:375B / 5B / 2B
2tails130.25602017/11/16 15:44:235B / 5B / 3B
3tails100.26282017/11/24 11:34:474B / 4B / 2B

Scala _

RankUserSizeTimeDateStatistics
1rotary-o486.09712017/11/11 13:36:560B / 32B / 14B

Language Ranking_

RankLangUserSizeScore
1gs2tails1010000
2Rubymitchs254000
3Ruby2mitchs254000
4sedtails273703
5Pythonmitchs352857
6Python3llhuii362777
7Scalarotary-o482083
8Cllhuii571754
9Haskellhenkma601666

return to the top page