MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / exp

Function exp

CPP/array-2d/recursive.cpp:3–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include<iostream>
2using namespace std;
3bool exp(int arr[],int n,int target,int count=0)
4{
5 ;
6 if(count==3&&target==0)
7 return true;
8 if(count==3||n==0||target<0)
9 return false;
10 return exp(arr, n - 1, target - arr[n - 1], count + 1) ||
11 exp(arr, n - 1, target, count);
12}
13int main(){
14 int arr[]={ 2, 7, 4, 0, 9, 5, 1, 3 };
15 int target = 6;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected