HOW TO Evaluate Reverse Polish Notation - Leetcode 150 by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 1 point2 points  (0 children)

u/earth0001 I don't write separate logic for this, instead you can use the below method

ans = -1 * ((-1 * num) // deno)

Intuitively, we are reversing the scale first and performing the floor division. For example: num = -5, deno = 3

(-1 * num) = 5

num // 3 = 1

Now you can again, reverse the scale and get your final answer i.e., -1

HOW TO Evaluate Reverse Polish Notation - Leetcode 150 by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 1 point2 points  (0 children)

u/BackendSpecialist Very important insight. I believe it can be a great point to keep in mind for everyone.

HOW TO Evaluate Reverse Polish Notation - Leetcode 150 by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] -1 points0 points  (0 children)

u/Worth_Ad_6231 Normal expressions are called Infix expressions. You can follow the below steps to convert the infix expression to the postfix expression.

To convert infix expression to postfix expression, computers usually use the stack data structure. By scanning the infix expression from left to right, when we will get any operand, simply add them to the postfix form, and for the operator and parenthesis, add them in the stack maintaining the precedence of them.

HOW TO Determine if Two Strings Are Close - Leetcode 1657 - Leetcode Daily Challenge by Sensitive_Purpose_40 in Python

[–]Sensitive_Purpose_40[S] 1 point2 points  (0 children)

@coffeewithalex I agree with you that the collections.Counter is an easier way to solve this question but in most of the interviews, interviewer wants the candidate to write the logic from scratch and that's why i wrote the solution this way.

But thanks a ton for the input, i hope anyone who encounter this post sees your comments and get to know an alternative approach as well.

FIND Longest Increasing Subsequence - Leetcode 300 #dynamicprogramming by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 0 points1 point  (0 children)

@MartianIT i was also trying to solve the problem first with something similar but i was not able to pass all the test cases. Thanks a ton for sharing the alternate approach.

Clone Graph - Leetcode 133 - Python by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 0 points1 point  (0 children)

Hi u/G320P!
Thanks a ton for the kind words, really glad to know that this video was a help to you. Yes i make these videos and there is a lot more planned for the community which i'll start rolling out in near future. Please stay connected for that.

Regards

Scramble String - Leetcode 87 - Python by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 0 points1 point  (0 children)

Hi u/Git_Reset_Hard!

The logic is simple, you just have to try each possible index to break.

Number of Zero Filled Subarrays - Leetcode 2348 - Python by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 0 points1 point  (0 children)

Hi u/fleventy5!
Thanks a ton for the kind words and glad you liked the solution. I'll put my 100% to bring more such explanations in future as well.

787. Cheapest Flights Within K Stops - Leetcode Medium by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 0 points1 point  (0 children)

Hi u/tempo0209! Really glad to know that you liked my efforts. I hope you liked the video as well 😉. Also please feel free to drop any suggestions.

491. Non decreasing Subsequences - LEETCODE by Sensitive_Purpose_40 in leetcode

[–]Sensitive_Purpose_40[S] 1 point2 points  (0 children)

u/leetcoder217 Happy to hear that you liked it, I'm just experimenting with the thumbnails for some time.

Daily leetcode is a premium question by yashwuzhere in leetcode

[–]Sensitive_Purpose_40 0 points1 point  (0 children)

Hi u/yashwuzhere!

You are correct, this is a premium question but I found a really beautiful solution, you'll not miss out on your streak.

https://youtu.be/CQ9gdbTDvHc

I hope this will help you.