LeetCode

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ย. 2024

ความคิดเห็น • 31

  • @karlagabriel3970
    @karlagabriel3970 ปีที่แล้ว +13

    I really appreciate the explanation and how you visualize the problem! Great stuff!

  • @dnm9931
    @dnm9931 7 หลายเดือนก่อน +1

    Very clear concise explanation and visualisation! Thank you very much and please keep posting! You are highly appreciated!

  • @jpkeys6000
    @jpkeys6000 9 หลายเดือนก่อน +1

    Once again, best visuals and explanation out there!

  • @yilinliu2238
    @yilinliu2238 2 หลายเดือนก่อน

    the grid visualization really helped. finally understood this problem thank you

  • @jpkeys6000
    @jpkeys6000 9 หลายเดือนก่อน

    Once again, best explanation and visuals out there, thank you!

  • @bullymaguire2335
    @bullymaguire2335 ปีที่แล้ว +1

    perfect . simplified .really easy to understand .kudos man . cant wait for more

  • @rojerdu2759
    @rojerdu2759 ปีที่แล้ว +1

    Awesome! Been waiting for this one!

  • @user-yz3yo1ql7p
    @user-yz3yo1ql7p ปีที่แล้ว +1

    Very clear explanation, thanks!!!

  • @ChamplooMusashi
    @ChamplooMusashi 11 หลายเดือนก่อน

    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

  • @abhinav_mittal
    @abhinav_mittal 11 หลายเดือนก่อน

    by far the easiest explaination

  • @adammason482
    @adammason482 ปีที่แล้ว +1

    Thank you!

  • @voicubogdan4339
    @voicubogdan4339 10 หลายเดือนก่อน

    Great explanation, i ha to watch it 2 times, but i understood it

  • @skinnycucumber
    @skinnycucumber ปีที่แล้ว

    thanks for this, and thanks for the captions.

  • @leetcodemonkey
    @leetcodemonkey 8 หลายเดือนก่อน

    Great explanation!

  • @guruprasaad4850
    @guruprasaad4850 หลายเดือนก่อน

    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 ปีที่แล้ว +2

    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  ปีที่แล้ว +2

      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  ปีที่แล้ว +1

      @@azka9075 It definitely comes down to practice! I promise it gets easier the more you practice 🙂

  • @cocotv1519
    @cocotv1519 2 หลายเดือนก่อน

    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.

  • @anwesagoswami5609
    @anwesagoswami5609 9 หลายเดือนก่อน

    thank you so much, good work...

  • @princessrad111
    @princessrad111 11 หลายเดือนก่อน

    This is amazing, thanks man

  • @lsdgaming7479
    @lsdgaming7479 11 หลายเดือนก่อน

    thank you very much

  • @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 9 หลายเดือนก่อน

      @@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)

  • @DevanshClasses
    @DevanshClasses 9 หลายเดือนก่อน

    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)

  • @tomdriver6733
    @tomdriver6733 ปีที่แล้ว

    Could you use C++, Java or C#, please? Python is hard to read.

  • @MaruBaku
    @MaruBaku ปีที่แล้ว

    discord server?

    • @AlgoEngine
      @AlgoEngine  ปีที่แล้ว

      No discord server right now, but I may make one in the future!