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 Solvers4
Suggested Problems
-
6692 Solvers
-
Find the largest value in the 3D matrix
1604 Solvers
-
Matrix indexing with two vectors of indices
756 Solvers
-
Chebyshev polynomials of the 1st Kind
75 Solvers
-
Define the operators of function_handles
54 Solvers
More from this Author43
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!