Problem 56433. Canadian Conundrum
Your trip is amongst the mighty mountains of Canada and whilst planning your trip, you come across a situation -
Due to the terrain of the mountains, you are confined to move forward in diagonal directions (North-East and South-East). And to avoid the risk of falling off (below x-axis is the death valley) or an accident, you have to take one step at a time.
The geographics of the track are similar to the previous problem, in a form of a 2-D rectangular lattice spanning from (0,0) to (2*m,n).
In order to plan the route of your trip, it is necessary to visualize all the routes. To fulfill the necessary requirement of visualizing the routes, you, now, have to count the paths with exactly n number of peaks (local maxima); from your initial position (although relative, consider it to be 0,0) to the end point (2*m,0).
You being an avid mathematics aficionado, are compelled to solve the problem.
Given two natural numbers, m and n (<=m), find the number of routes with the mentioned restriction, to prepare a strategy.
Example: All possible pathways for m=3
For n=2, output should be 3 > as there are 3 possible routes with exactly 2 peaks.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers3
Suggested Problems
-
The Goldbach Conjecture, Part 2
2364 Solvers
-
Back to basics 12 - Input Arguments
599 Solvers
-
299 Solvers
-
Remove from a 2-D matrix all the rows that contain at least one element less than or equal to 4
136 Solvers
-
220 Solvers
More from this Author31
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!