Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 546 Bytes

index.md

File metadata and controls

23 lines (15 loc) · 546 Bytes

Recursion

What is Recursion?

The simplest way to think of recursion is a function that calls itself until the problem is solved. This usually involves what is referred to as a "base case". A base case is the point which the problem is solved at.

Simple Example

function foo(n: number): number {
    //base case
    if (n === 1) return 1;

    // we shall recurse
    return n + foo(n - 1);
}

recursion

Path Finding

path finding