Given a side length `n`, traveling only right and down how many ways are there to get from the top left corner to the bottom right corner of an `n by n` grid?

Your mission is to write a program to do just that!

Add code to `route(n)` that returns the number of routes for a grid `n by n` (if n is less than 1 return 0).

Examples:
    
    -100 -> 0
    
    1 -> 2
     
    2 -> 6
     
    20 -> 137846528820
    
Note: 
you're traveling on the edges of the squares in the grid not the squares themselves.

PS.If anyone has any suggestions of how to improve this kata please let me know.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Ad-hoc

Starter code: def routes(n):
	

Solutions:
from math import factorial

def routes(n):
	return n > 0 and factorial(2 * n) // factorial(n) ** 2


from math import factorial as f
routes = lambda n: f(n * 2) // (f(n) * f(n)) if n > 0 else 0


def routes(n):
	if n < 1:
		return 0
	res = 1
	for i in range(1, n + 1):
		res = res * (n + i) // i
	return res


from math import factorial as f

def routes(n):
	return f(n * 2) // f(n) ** 2 if n > 0 else 0