`{"id":"e5b23abf-edfc-45e0-b0cc-7822ca6fb629","name":"Catalan Number","description":"1. You are given a number n.\r\n2. You are required to find the value of nth catalan number.\r\nC0 -> 1\r\nC1 -> 1\r\nC2 -> 2\r\nC3 -> 5\r\n..\r\nCn -> C0.Cn-1 + C1.Cn-2 + .. + Cn-2.C1 + Cn-1.C0","inputFormat":"A number n","outputFormat":"A number representing the value of nth catalan number.","constraints":"0 &lt;= n &lt;= 15","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"4","sampleOutput":"14","questionVideo":"https://www.youtube.com/embed/eUw9A1wsFg8?end=203","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"0fb02aff-fb20-4773-85a8-02e2388a1414","name":"Catalan Number","slug":"catalan-number","type":1}],"next":{"id":"642a92ce-79bb-41f3-bcfb-696599c9f5b7","name":"Number Of Bsts","type":1,"slug":"number-of-bsts"},"prev":{"id":"7c0491c0-468f-4a92-b0f8-e9ccc66d7579","name":"Russian Doll Envelopes","type":1,"slug":"russian-doll-envelopes"}}}`

# Catalan Number

1. You are given a number n. 2. You are required to find the value of nth catalan number. C0 -> 1 C1 -> 1 C2 -> 2 C3 -> 5 .. Cn -> C0.Cn-1 + C1.Cn-2 + .. + Cn-2.C1 + Cn-1.C0

`{"id":"e5b23abf-edfc-45e0-b0cc-7822ca6fb629","name":"Catalan Number","description":"1. You are given a number n.\r\n2. You are required to find the value of nth catalan number.\r\nC0 -> 1\r\nC1 -> 1\r\nC2 -> 2\r\nC3 -> 5\r\n..\r\nCn -> C0.Cn-1 + C1.Cn-2 + .. + Cn-2.C1 + Cn-1.C0","inputFormat":"A number n","outputFormat":"A number representing the value of nth catalan number.","constraints":"0 &lt;= n &lt;= 15","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"4","sampleOutput":"14","questionVideo":"https://www.youtube.com/embed/eUw9A1wsFg8?end=203","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"0fb02aff-fb20-4773-85a8-02e2388a1414","name":"Catalan Number","slug":"catalan-number","type":1}],"next":{"id":"642a92ce-79bb-41f3-bcfb-696599c9f5b7","name":"Number Of Bsts","type":1,"slug":"number-of-bsts"},"prev":{"id":"7c0491c0-468f-4a92-b0f8-e9ccc66d7579","name":"Russian Doll Envelopes","type":1,"slug":"russian-doll-envelopes"}}}`

Editor

# Catalan Number

easy

1. You are given a number n. 2. You are required to find the value of nth catalan number. C0 -> 1 C1 -> 1 C2 -> 2 C3 -> 5 .. Cn -> C0.Cn-1 + C1.Cn-2 + .. + Cn-2.C1 + Cn-1.C0

0 <= n <= 15

## Format

A number n

### Output

A number representing the value of nth catalan number.

## Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}4`

### Sample Output

`.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}14`

Question Video

Discussions

Show Discussion

Related Resources