File: root - text - article - 2019 - 11 - ways-to-traverse-a-grid.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 342 Views, 16953 Search Bots | 80 Words
| Browse | Archive
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 342 Views, 16953 Search Bots | 80 Words
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Hi, here's your problem today. This problem was recently asked by Microsoft:
You 2 integers n and m representing an n by m grid, determine the number of ways you can get from the top-left to the bottom-right of the matrix y going only right or down.
Example:
n = 2, m = 2
This should return 2, since the only possible routes are:
Right, down
Down, right.
Here's the signature:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 342 Views, 16953 Search Bots | 80 Words You 2 integers n and m representing an n by m grid, determine the number of ways you can get from the top-left to the bottom-right of the matrix y going only right or down.
Example:
n = 2, m = 2
This should return 2, since the only possible routes are:
Right, down
Down, right.
Here's the signature:
def num_ways(n, m):
# Fill this in.
print num_ways(2, 2)
# 2
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Related Articles
- Algorithm Interview Question: Find the Single Element in an Array of Duplicates
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Daily Interview Problem: Merge List Of Number Into Ranges
- Print a tree level-by-level, with line-breaks
- Daily Interview Problem: Given two arrays, write a function to compute their intersection.
- Algorithm Interview Question: Symmetric k-ary Tree
- Daily Interview Problem: Queue Using Two Stacks
- Daily Interview Problem: Get all Values at a Certain Height in a Binary Tree
- CVE-2015-8874 - cPanel EasyApache Vulnerabilities
- First and Last Indices of an Element in a Sorted Array
©2006~2024 SteakOverCooked - 0.01431 Seconds(s) - 3697.547 KB/s - 32 Online
Memory: 530.01 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
![](/images/top.jpg)
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !