Menu
Coddy logo textTech

Pascal's Triangle: Follow-up

Lesson 3 of 3 in Coddy's Interview Coding Challenges - Pack VI course.

challenge icon

Challenge

Medium

Given an integer n, return just the n<sup>th</sup> row of the Pascal's triangle. You should treat the triangle as 0-indexed.

 

Examples:

 

Input: 0

Expected output: [1]

 

Input: 1

Expected Output: [1, 1]

 

Input: 2

Expected Output: [1, 2, 1]

 

Can you do it in O(n) time complexity?

Try it yourself

#include <stdlib.h>

int* get_pascals_row(int n, int* returnSize) {
    // Write code here
}

All lessons in Interview Coding Challenges - Pack VI

1Challenges

Stair ClimbingPascal's Triangle: Warm-upPascal's Triangle: Follow-up