You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Approach: Here, the solution will make a count[] to keep track of all the elements in a sorted order.
At each index of count[] it will add the total sum of number = index. The equation here will find the max of two values.
Value1 is calculated using count[i]+dp[i+2] i.e. it at index i it will consider the number itself and will ignore the next sequencial number
of it and will add to the dp[i+2]. Value2 is calculated by not considering the number itself and so we can consider the next max sum till the consecutive number