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

  • @junaidmahmud2894
    @junaidmahmud28944 ай бұрын

    Just solved the problem and came to KZread and Boom! your solution! You're amazing man!

  • @swauce507
    @swauce5074 ай бұрын

    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

    @unknownbirdpro

    4 ай бұрын

    How many problems did you solve till now?

  • @shreehari2589

    @shreehari2589

    4 ай бұрын

    Which company?

  • @dingus2332
    @dingus23324 ай бұрын

    Solved with First Intuition , but have always in store for us to learn !

  • @metarus208
    @metarus2084 ай бұрын

    thanks Navdeep

  • @OverrideTips
    @OverrideTips4 ай бұрын

    As always I’m here!🙏🏼🙏🏼 fire video, still waiting for the military discount 😂

  • @suryarajendran7736
    @suryarajendran77364 ай бұрын

    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!!!

  • @Doggy_Styles_Coding
    @Doggy_Styles_Coding4 ай бұрын

    nice one

  • @LlamaBG
    @LlamaBG4 ай бұрын

    WHERE IS THE VIDEO MAN

  • @Andrew_J123
    @Andrew_J1234 ай бұрын

    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

    @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

    @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

    @1vader

    4 ай бұрын

    @@jeehar1Inlining the variable is super unreadable, definitely not more pythonic.

  • @leeroymlg4692

    @leeroymlg4692

    4 ай бұрын

    @@jeehar1 worse readability

  • @anirbanhossen6170
    @anirbanhossen61704 ай бұрын

    @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