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 | 552 Views, 20903 Search Bots | 80 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 552 Views, 20903 Search Bots | 80 Words
| Browse | Archive
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 | 552 Views, 20903 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
Related Articles
- Find Missing Numbers in an Array
- Multitasking
- Algorithm Interview: Shifted String
- Algorithm Interview: Level Order Traversal of Binary Tree
- Reverse a Directed Graph
- Daily Interview Problem: Spiral Traversal of Grid
- Daily Interview Problem: Reverse Integer
- Daily Interview Puzzle: Falling Dominoes
- Algorithm Interview: Longest Consecutive Sequence
- Daily Interview Problem: Largest BST in a Binary Tree
©2006~2024 SteakOverCooked - 0.01112 Seconds(s) - 1784.319 KB/s - 32 Online Memory: 493.15 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="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !