Leetcode - Basic Calculator (Python)

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024
  • September 2021 Leetcode Challenge
    Leetcode - Basic Calculator #224
    Difficulty: Hard

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

  • @yang5843
    @yang5843 2 ปีที่แล้ว +22

    How does every other youtuber spend 20 minutes badly explaining their process yet this guy elegantly explains the problem in 7 minutes ?

  • @thetiltfactory1760
    @thetiltfactory1760 2 ปีที่แล้ว +5

    I was asked this problem in a FAANG company in November and wish should've come across your channel earlier

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

      Which company were you being interviewed for?

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

    After trying to solve this at timestamp 48:12:91, only having passed 8 test cases out of 46, seeing this straightforward approach and really intuitive code is discouraging me, I cannot lie. I have to keep going, I know, but sometimes I wonder if I am simply incapable of solving some questions. I would like to think that is not the case.

  • @leoliu-ny4fh
    @leoliu-ny4fh หลายเดือนก่อน

    very nice explained, appreciated!!!

  • @sardines4dinner
    @sardines4dinner 2 ปีที่แล้ว

    shouldn't we do cur = 0 in the c="(" loop, to calculate what's in the brackets? I tried that and it still works...

  • @SeattlePiPiPi
    @SeattlePiPiPi 2 ปีที่แล้ว +3

    I was wondering why cur * 10?

    • @sardines4dinner
      @sardines4dinner 2 ปีที่แล้ว +6

      e.g. for 123, the code would see 1 first, then when it sees 2, it would do 1X10 + 2 = 12, and then when it sees 3 it would do 12*10 +3 = 123. It just moves the first number by a tenth place each time. of course if an operator or bracket appears, it resets.

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

      @@sardines4dinnerthank u brub 🙏

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

      You could have a digit made out of multiple characters. So that takes care of the entire digit.

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

    The recursive solutions in the discussion are so hard to understand -___-

  • @chrisrectenwald7307
    @chrisrectenwald7307 2 ปีที่แล้ว +3

    Is this your first time seeing the problem?

    • @gomzomz
      @gomzomz 2 ปีที่แล้ว +11

      there's no chance

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

      I don't believe someone could solve it so accurately and efficiently in the fry try

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

    Well explained!

  • @chaengsaltz829
    @chaengsaltz829 2 ปีที่แล้ว

    Master!

  • @derrickxu7784
    @derrickxu7784 2 ปีที่แล้ว

    great explanation !!!

  • @akmaurya07
    @akmaurya07 2 ปีที่แล้ว

    do not trust me rofl!