Recca Chao 的 gitHub page

推廣網站開發,包含 Laravel 和 Kotlin 後端撰寫、自動化測試、讀書心得等。Taiwan Kotlin User Group 管理員。

View on GitHub

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:

def num_ways(n, m):
  # Fill this in.

print num_ways(2, 2)
# 2