Final Prices With a Special Discount in a Shop - Leetcode 1475 - Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

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

  • @saketh8937
    @saketh8937 12 ชั่วโมงที่ผ่านมา +3

    I believe at 3:17 the last 9 can't have any discount... for that matter any last price can't have a discount, So the last price remains as it is.

    • @NeetCodeIO
      @NeetCodeIO  10 ชั่วโมงที่ผ่านมา +2

      Thsts right, silly mistake on my part

  • @JamesBond-mq7pd
    @JamesBond-mq7pd 22 ชั่วโมงที่ผ่านมา +4

    So, today I learned what a monotonic stack is.

    • @akifimran9780
      @akifimran9780 7 ชั่วโมงที่ผ่านมา +1

      Mee too dude.I was so close to solving it by myself, just couldn't actually do it

  • @tankiheart6899
    @tankiheart6899 19 ชั่วโมงที่ผ่านมา +4

    I just noticed that the color of your shirt in the thumbnail changes based on the difficulty

    • @GelloMello-j9z
      @GelloMello-j9z 18 ชั่วโมงที่ผ่านมา

      Nice. He doesn't have a yellow shirt tho lol

  • @malachiwhite5955
    @malachiwhite5955 วันที่ผ่านมา +1

    Crazy I just gave this problem a shot and you come out with the answer lmaoo

  • @user-my6yf1st8z
    @user-my6yf1st8z 20 ชั่วโมงที่ผ่านมา

    thanks boss, nice thumbnail pic as always 😁😂😂😂

  • @UltiRequiem
    @UltiRequiem วันที่ผ่านมา +1

    first here bro, just started uploading leet code vids on spanish

  • @aadill77
    @aadill77 8 ชั่วโมงที่ผ่านมา

    Lol. I thought you were upselling discount on your neetcode website 😅

  • @anayshah13
    @anayshah13 19 ชั่วโมงที่ผ่านมา

    i got the same passing percentages 100,10.22% with the brute force/O(n square) solution....this happens a lot with me,i get very randomized passing percentages at times and that leads me to doubt myself everytime or think im doing bad even if its a 100%(true in this case)....can someone explain me how it works...i rerun it at times and it changes from 100 to 50!?like is based on my internet speed or smth...i hv no clue anymore
    plzzz help me understand

    • @UtkarshMishraplus
      @UtkarshMishraplus 2 ชั่วโมงที่ผ่านมา

      The percentile score is unreliable and misleading. For example, the test cases were run on a very small range of data set, so even O(N sqrd) algorithms didn't take time to run on their servers.
      rely on the time/space complexity to analyse your result. I guess the percentile matters the most during contests.

  • @EngineerWallah
    @EngineerWallah 17 ชั่วโมงที่ผ่านมา +1

    A more simpler solution:
    Initialize two pointer left and right.
    right points to last element
    left points to second last element.
    Copy the last element to result arr.
    Initialize min variable to 0.
    The repeat:
    If left < right:
    result[left] = arr[left] - min
    if right < left:
    result[left] = arr[left] - arr[right]
    min = right
    left = left - 1
    right = right - 1