238. Product of Array Except Self | Math | Prefix Product | 4 Approaches
In this video, I'll talk about how to solve Leetcode 238. Product of Array Except Self | Math | Prefix Product | 4 ways
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
100Days 100k Placements: • 100 Days 100K Placement
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
0:00 - Problem Explanation
2:54 - Approach1 - Brute Force
4:36 - Approach2 - Using Division
9:16 - Approach3 - Using Prefix Product
17:33 - Approach4 - Prefix Product Optimised
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
Пікірлер: 12
Great Explanation
Thank you 😊
NICE, BROTHER. KEEP POSTING SUCH DAILY CHALLENGES! THANKS.
Bhai ye O(1) extra space me bhi ban jayga just need to take the count lf zeros if zeros are more than 1 no matter what all values will be zero of zeros are 1 for sure that vak can be calculated and if no zeros in the array it's fine as well
We can do it by using division operation also. But according to this constraint it is of no value. class Solution { public: vector productExceptSelf(vector& nums) { vector vt; int p=1,z=1,flag=0,c=0,co=0; for(int i=0;i
Count the Zeroes , if more than 1 zeroes are there then entire ans array will be Zero , but if only 1 zero is there then will compute product of entire array by skipping that one zero and during computing ans array we will put zero in all ans[i] and when we encounter zero we will put product in that case ! Maybe this will work!
@salihedneer8975
20 күн бұрын
question tells us that don't use division operator
nice
how come multiplying 30 , 10^5 times makes 30*10^5 ?? it should be 30^(10^5)
Ye sb band karo do ab...devin kar dega
@anonymous5946
4 ай бұрын
Devin ko bhi Human ( programer) to Kal kon Tum bhi bana sakte ho
ladu aram se bolkr