Daily Code Byte

Please provide some hint on how to approach the Daily Code Byte problems of 18 and 19 May .

@sameershar98 hey shubham
first we take about the daily code byte problems of 18 may which is the subset target to sum
you this problem related to the dynamic programming all you need to do is to make a dynamic array of size subset[n+1][sum+1];
the reason of doing this we are now calculating solution of this problem using bottom up dp
so algorithm of this problem is
1 take input size n
2 take target sum
3 input array
4 make a boolean function which return true or false if the target sum is present or not

now let take about function
what parameter need to pass in the function
1 input array
2 target sum
3 size of input array
now make a dynamic array of 2 dimension
subset[n+1][sum+1];
now initially apply memset on the array to fill with zero so that array doesn’t take any garbage value
apply a loop
for(int i=0;i<n;i++ )
subset[i][0]==mark with true;
for(int j=0;j<sum;j++){
subset[0][j]==mark with false;
now let take about how bottom up comes into picture
start loop from i=1 to upto n
and start a nested loop j=1 to upto sum
and check for j<set[i-1];
if the above condtion is true thensubset[i][j]=subset[i-1][j];
again check for j>=set[i-1]
if above condtion true then
subset[i][j]=subset[i-1][j]||subset[i-1][j-set[i-1]];
at last share the result by returning the index of subset[n][sum];
if this particular index of the problem contain 0 mean target not present and 1 means target present
do a dry run hope it will help you

@sameershar98 hey shubham now let talk about daily code byte of 19 may
Inverse of the array
Given an array of size n of integers in range from 1 to n, we need to find the inverse permutation of that array.

An inverse permutation is a permutation which you will get by inserting position of an element at the position specified by the element value in the array. For better understanding, consider the following example:
now how to code this problem is
make a function which take input array as argument
and size
and also you need to make a new array in the function to store the element position with first like
for (int i = 0; i <n; i++) {
rv[arr[i]] = i;

	}

now print the rv array in the function
by simple iterating