6 kyu

Travelling on a Grid

290 of 613mmalkavian

Description:

You have an 8x8 grid with coordinates ranging from 1 to 8. The origin (1, 1) is in the top left corner. The bottom right corner is (8, 8).

You are given a string as an input which will contain the 2 coordinates in this format: "(x1 y1)(x2 y2)", where (x1 y1) represents point A and (x2 y2) represents point B. In the inputs provided, point A will always be up and to the left of point B. In other words, x1 < x2 and y1 < y2 will be true for every input.

Your goal is to find out the number of different paths you can take to get from point A to point B by moving one cell at a time either down or right.

Example

Given an input of "(2 3)(3 5)", the number of possible paths to get from A to B is 3.

 .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .
 .  A  .  .  .  .  .  .
 .  .  .  .  .  .  .  .
 .  .  B  .  .  .  .  .
 .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .

Possible paths, marked with x:

A .       A .       A x
x .       x x       . x
x B       . B       . B
Puzzles
Algorithms

Stats:

CreatedDec 5, 2016
PublishedDec 5, 2016
Warriors Trained1653
Total Skips68
Total Code Submissions1677
Total Times Completed613
Python Completions290
JavaScript Completions190
Java Completions134
Ruby Completions25
Haskell Completions12
Total Stars58
% of votes with a positive feedback rating89% of 151
Total "Very Satisfied" Votes124
Total "Somewhat Satisfied" Votes20
Total "Not Satisfied" Votes7
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • mmalkavian Avatar
  • anter69 Avatar
  • user5036852 Avatar
  • JohanWiltink Avatar
  • ejini战神 Avatar
Ad