Maximize The Cut Segments | gfg potd today | POTD | GFG Problem of the Day | C++ |
HTML-код
- Опубликовано: 16 сен 2024
- Today's problem is really a good problem based on Maximize The Cut Segments ,stay with the video till the end definitely u will learn something from here and make sure to like , comment and share the video and subscribe the channel
Hey welcome to the Channel Here is the Potd Poblem solution .
The potd solution for the GeekForGeeks and the Leetcode both are provided at this Channel .
For More Coding Related Videos Stay Connected to the Channel #CodeThurst
Here is the SOlution video of the Problem of the day.
If you understood the solution please make sure to subscribe the channel and hit the like button .
============================================================================
Connect with me ☺️☺️:-
Linkedin :- / vishal-ansari-786zv
Instagram handle:- ...
=======================================================================
-------------------------------------------------------------------------------------------------------------------
POTD QUESTION LINK:-
www.geeksforge...
-----------------------------------------------------------------------------------------------------------------------
POTD SOLUTION LINK:-
github.com/Vis...
--------------------------------------------------------------------------------------------------------------------------
gfg potd, gfg potd today, potd, gfg, gfg problem of the day/ Problem of the Day/Maximize The Cut Segments / Maximize The Cut Segments gfg potd/ Maximize The Cut Segments ,Maximize The Cut Segments /problem of the day/ Maximize The Cut Segments / Maximize The Cut Segments potd, gfg potd, gfg , C++, Java, Python
gfg, gfg POTd, gfg POTD gfg,potd today gfg, today potd, gfg today, gfg today potd,
july potd,
#gfg #problemoftheday #gfgpotd #gfgpractice
#leetcode
#coders
#POTD
#github
#share #like #Subscribe #comment
companies:-
#Paytm #Flipkart #MorganStanley #Accolite #Amazon #Microsoft #Samsung
#D-E-Shaw #Hike #MakeMyTrip #Ola #Cabs #Oracle #Walmart #Goldman #Sachs #Directi #Intuit #SAP #Labs #Quikr #Facebook #Salesforce #Pubmatic #Sapient #Swiggy
#CodeThurst #dsa #programming #gfg #gfgpotd #problemsolving #coding #softwareengineer #faang #dsa #amazon #microsoft #competitiveprogramming #dsasheet #interviewpreparation #gfg #gfg_potd #problemoftheday #today #gfgtoday
#programming
#coding
#computerscience
#codinglife
#tech
#algorithm
#datastructures
#leetcode
#hackerrank
#geeksforgeeks
#interviewprep
#codenewbie
#learnprogramming
#codegoals
#microsoft #Amazon #amazon #flipkart #google #deshaw #adobe #morgan #stanley
#morganstanley #Samsung #oyo #visa #Accolite
Great
thnks
❤❤❤❤❤👍👍👍
here's the correct code
int solve(int n, int x, int y, int z, vector& dp){
if(n == 0) return 0;
if(n < 0) return INT_MIN;
if(dp[n]!=-1) return dp[n];
int one=INT_MIN, two=INT_MIN, three=INT_MIN;
one=solve(n-x, x,y,z,dp);
two=solve(n-y, x,y,z,dp);
three=solve(n-z, x,y,z,dp);
return dp[n] = 1+max(one,max(two,three));
}
int maximizeTheCuts(int n, int x, int y, int z)
{
vector dp(n+1,-1);
int ans=solve(n,x,y,z ,dp);
if(ans
why we are adding 1 in return of 1+max(one,max(two,three)) ???
if we move with any of the option we are making a cut
so thts why
17/08/24-->
EASY PEASY with 1 Lakh 400 test case 😂😂🤣🤣 -->
class Solution {
public:
vector productExceptSelf(vector& nums) {
vectorresult(nums.size());
long long int temp=1;
int isZero=0;
for(auto&ele:nums){
if(ele==0){
isZero++;
continue;
}
temp=(temp*ele);
}
for(int i=0;i1)result[i]=0;
else
result[i]=(temp)/nums[i];
}
return result;
}
};
yess bro easy 🥱🥱
Why you have added 1 with max val?
if we move with any of the option we are making a cut
so thts why