Menu
Coddy logo textTech

Find Triplet

Lesson 11 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.

challenge icon

Challenge

Medium

Write a function named isTripletExists that gets an array of integers arr and an integer k and returns true if there is a triplet of numbers (3 numbers) which sum to k else return false.

Example,

  • isTripletExists([2, 7, 4, 3], 9)  ->  true (The triplet {2, 4, 3})

Try it yourself

#include <stdbool.h>

bool isTripletExists(int *arr, int size, int k) {
    // Write code here
}

All lessons in Recursion Challenges - Master The Recursive Thinking