← Back to challenges

Catalan Number

JavaScriptHardmathlanguage_fundamentals

Instructions

Create a function that returns the nth catalan number.In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. They are named after the Belgian mathematician Eugène Charles Catalan (1814–1894). For more info, check out the resource tab.

Examples

getCatalanNumber(0) ➞ 1

getCatalanNumber(6) ➞ 132

getCatalanNumber(8) ➞ 1430

Notes

Inputs are zero and positive integers.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.