Thursday, October 22, 2020

22-10-20

PROBLEM
SOLUTION
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int find_nth_term (int n, int a, int b, int c) {
    if(n == 1) return a;
    if(n == 2) return b;
    if(n == 3) return c;
    return find_nth_term(n-1, a, b, c) + find_nth_term(n-2, a, b, c) + find_nth_term(n-3, a, b, c);
}

No comments:

Post a Comment

LEETCODE JUNE 2021 DAILY CODING CHALLENGE

 LEETCODE JUNE 2021 DAILY CODING CHALLENGE JUNE 1 JUNE 2 JUNE 3 JUNE 4 JUNE 5 Maximum Performance of a Team LINK You are given two integers ...