Maximum Odd Binary Number - Leetcode 2864 - Python
🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🧑💼 LinkedIn: / navdeep-singh-3aaa14161
🐦 Twitter: / neetcode1
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
Problem Link: leetcode.com/problems/maximum...
0:00 - Read the problem
0:27 - Drawing Explanation
2:29 - Coding Explanation
4:36 - Drawing Explanation
7:44 - Coding Explanation
leetcode 2864
#neetcode #leetcode #python
Пікірлер: 17
Just solved the problem and came to KZread and Boom! your solution! You're amazing man!
Thanks to you neetcode, after spending my entire 4th year grinding leetcode I recieved my 1st fulltime swe offer after I graduate!!! Thank you for all you do!
@unknownbirdpro
4 ай бұрын
How many problems did you solve till now?
@shreehari2589
4 ай бұрын
Which company?
Solved with First Intuition , but have always in store for us to learn !
thanks Navdeep
As always I’m here!🙏🏼🙏🏼 fire video, still waiting for the military discount 😂
It will be really helpful if you could share an excel just like how you did for blind75 for the neetcode150 problems too. Thanks in advance!!!
nice one
WHERE IS THE VIDEO MAN
Bit of a pythonic solution but it's neat imo. class Solution: def maximumOddBinaryNumber(self, s: str) -> str: ones = s.count("1") zeros = s.count("0") return (ones-1)*'1' + zeros*'0' + '1'
@jeehar1
4 ай бұрын
you don't need to count zeros, zeros = len(s)-ones. A more pythonic way would be : def maximumOddBinaryNumber(self, s: str) -> str: return '1' * ((ones:=s.count('1')) - 1) + '0' * (len(s)-ones) + '1'
@Andrew_J123
4 ай бұрын
@@jeehar1 I agree you don't have to count zeros but imo I still kinda like mine as I see it as a bit more readable although I appreciate you using the walrus operator (At least that's what I think := is called)
@1vader
4 ай бұрын
@@jeehar1Inlining the variable is super unreadable, definitely not more pythonic.
@leeroymlg4692
4 ай бұрын
@@jeehar1 worse readability
@NeetCodeIO Minimum Operations to Exceed Threshold Value II solve this without using queue ged rid of the Time Limit Exceeded 671 / 675 testcases passed(my solution)using sorting