## How to Find all subsequences with sum equals to K

[Question] : In a given array find all possible sequence whose sum is certain number: For example:- [4,8,4] Target Sum = 8 So Output will be [4,4] [8]

recursion code examples in swift language.

[Question] : In a given array find all possible sequence whose sum is certain number: For example:- [4,8,4] Target Sum = 8 So Output will be [4,4] [8]

Here we will discuss two level recursion in swift. If there is statement before the recursive function it will print in sequence & vice versa. Here is example code with print statement –

[Question]: We haveGiven an array, generate all the possible subarrays of the given array using recursion for example :

[Question] : Reverse array using recursion Example: [1,2,3] = [3,2,1]. Approach #1 using two variables : – // Approach#2: Using single pointer/variable so we written base case which blocks on n/2, we are just increasing the element by +1 on every recursion till half of the array.

So here we have used recursion The names which is before function will print FIFO & vice versa

A function which calls itself in the body & solve the problem is called recursion. we will take some example to understand #1 Print numbers from 1 to N Because Print is before recursion function it will print 1 to n #2 Print numbers from N to 1 #3 Sum of first N numbers #4 …