diff --git a/LeetCode/2592.Maximize Greatness of an Array.cpp b/LeetCode/2592.Maximize Greatness of an Array.cpp index 79aff33..0deeb7f 100644 --- a/LeetCode/2592.Maximize Greatness of an Array.cpp +++ b/LeetCode/2592.Maximize Greatness of an Array.cpp @@ -1,12 +1,7 @@ -/* - written by Pankaj Kumar. - country:-INDIA -*/ typedef long long ll ; const ll INF=1e18; const ll mod1=1e9+7; const ll mod2=998244353; -//Add main code here class Solution { @@ -14,19 +9,21 @@ class Solution int maximizeGreatness(vector &nums) { int n=nums.size(); - vector> v1(n); + vector v1(n); vector v2(n); int count=0; + for(int i=0;i=firstv2[pos]){ + while(pos=v2[pos]){ pos++; } if(pos