LeetCode

  Рет қаралды 23,434

Algo Engine

Algo Engine

Күн бұрын

Пікірлер
@karlagabriel3970
@karlagabriel3970 Жыл бұрын
I really appreciate the explanation and how you visualize the problem! Great stuff!
@dnm9931
@dnm9931 9 ай бұрын
Very clear concise explanation and visualisation! Thank you very much and please keep posting! You are highly appreciated!
@Sanai9
@Sanai9 Ай бұрын
the explanation of the logic is just fantastic!!
@yilinliu2238
@yilinliu2238 5 ай бұрын
the grid visualization really helped. finally understood this problem thank you
@jpkeys6000
@jpkeys6000 11 ай бұрын
Once again, best visuals and explanation out there!
@jpkeys6000
@jpkeys6000 11 ай бұрын
Once again, best explanation and visuals out there, thank you!
@廖敏翔-m8r
@廖敏翔-m8r Жыл бұрын
Very clear explanation, thanks!!!
@abhinav_mittal
@abhinav_mittal Жыл бұрын
by far the easiest explaination
@ChamplooMusashi
@ChamplooMusashi Жыл бұрын
Though I could understand what the solutions were doing there was not much for the intuition behind it. This puts that crucial piece of the puzzle together. Thank you
@bullymaguire2335
@bullymaguire2335 Жыл бұрын
perfect . simplified .really easy to understand .kudos man . cant wait for more
@rojerdu2759
@rojerdu2759 Жыл бұрын
Awesome! Been waiting for this one!
@skinnycucumber
@skinnycucumber Жыл бұрын
thanks for this, and thanks for the captions.
@leetcodemonkey
@leetcodemonkey 10 ай бұрын
Great explanation!
@voicubogdan4339
@voicubogdan4339 Жыл бұрын
Great explanation, i ha to watch it 2 times, but i understood it
@anwesagoswami5609
@anwesagoswami5609 11 ай бұрын
thank you so much, good work...
@adammason482
@adammason482 Жыл бұрын
Thank you!
@ruslan2676
@ruslan2676 Ай бұрын
how on earth you came up with this solution omg :D
@princessrad111
@princessrad111 Жыл бұрын
This is amazing, thanks man
@lsdgaming7479
@lsdgaming7479 Жыл бұрын
thank you very much
@guruprasaad4850
@guruprasaad4850 3 ай бұрын
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: i = 0 length = len(nums) j = length - 1 left = list([1]);right = list([1]) for i in range(length-1): left.append( left[i] * nums[i] ) right.append( right[i] * nums[j] ) # backwards j -= 1 right.reverse() out = [ i * j for i, j in zip(left, right) ] return out
@azka9075
@azka9075 Жыл бұрын
My only question is how do you even start coming up with an algorithm to solve it, i understand the solution but coming up with the solution in the first place is difficult for me, how do you think to start doing left and right products and multiply them?
@AlgoEngine
@AlgoEngine Жыл бұрын
I would give two suggestions for this. First, come up with an "dumb" brute force solution, then try to identify where improvements could be made. For this problem, I noticed that we were doing the same calculations over and over again, which was a hint that the optimal solution should only calculate each product once. Second, if you're really stuck and can't figure out the answer, it's ok to look at the solution, but take some time to really understand why the solution works. If you can understand how and why it works, it'll become easier for you to spot similar patterns in other problems.
@azka9075
@azka9075 Жыл бұрын
@@AlgoEngine I see, thank you! i guess it comes down to practice, kind of sad i dont have a natural talent for spotting solutions :(
@AlgoEngine
@AlgoEngine Жыл бұрын
@@azka9075 It definitely comes down to practice! I promise it gets easier the more you practice 🙂
@cocotv1519
@cocotv1519 4 ай бұрын
Your explanation is really good but when u fill up the left and right, ur red line of box is not easy to understand. Instead of that, just say multiply every left side or multiply every right side elements. Not like one by one. For example, when we calculate every left side of 5, say 2*3*4. And I think until 4:12 mins are enough to understand this question. Thank you for your explanation.
@runesbroken
@runesbroken Жыл бұрын
Could you also find the product of all elements, and divide by each num[i] to create the product array
@AlgoEngine
@AlgoEngine Жыл бұрын
Unfortunately, the question prohibits us from using division (0:21) but if division was allowed, then yes, that would probably be the best way!
@DevanshClasses
@DevanshClasses 11 ай бұрын
@@AlgoEngine nums = [3, 2, 4,0] res=[] nums1=copy.copy(nums) print(nums1) for i in range(0, len(nums1)): nums1.remove(nums[i]) prod=reduce((lambda x,y:x*y),nums1) res.append(prod) nums1.insert(i,nums[i]) return(res)
@nilayyener858
@nilayyener858 5 күн бұрын
@@DevanshClasses The time complexity of this code is not O(n)
@tomdriver6733
@tomdriver6733 Жыл бұрын
Could you use C++, Java or C#, please? Python is hard to read.
@DevanshClasses
@DevanshClasses 11 ай бұрын
My Solution nums = [3, 2, 4,0] res=[] nums1=copy.copy(nums) print(nums1) for i in range(0, len(nums1)): nums1.remove(nums[i]) prod=reduce((lambda x,y:x*y),nums1) res.append(prod) nums1.insert(i,nums[i]) return(res)
@nilayyener858
@nilayyener858 5 күн бұрын
The time complexity of this code is not O(n)
@MaruBaku
@MaruBaku Жыл бұрын
discord server?
@AlgoEngine
@AlgoEngine Жыл бұрын
No discord server right now, but I may make one in the future!
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 5 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 12 МЛН
LeetCode #15: 3Sum | Coding Interview Question
9:26
Algo Engine
Рет қаралды 13 М.
PRODUCT OF ARRAY EXCEPT SELF | LEETCODE # 238 | PYTHON SOLUTION
16:52
Cracking FAANG
Рет қаралды 1,4 М.
Coding Unbreakable Encryption in C | One-Time Pad
17:42
HirschDaniel
Рет қаралды 4,3 М.
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 246 М.
Product of Array Except Self - Leetcode 238 - Python
11:54
NeetCode
Рет қаралды 648 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 577 М.
Product of array except self | Leetcode #238
15:00
Techdose
Рет қаралды 97 М.
LeetCode Day 15 - Product of Array Except Self
16:00
Errichto Algorithms
Рет қаралды 33 М.
Bresenham's Line Algorithm - Demystified Step by Step
16:10
NoBS Code
Рет қаралды 62 М.
LeetCode #53: Maximum Subarray | Dynamic Programming
7:50
Algo Engine
Рет қаралды 4,1 М.
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 5 МЛН