Search
⌘K

Leetcode 1702. Maximum Binary String After Change

Given a binary string, repeatedly apply the local rewrite rules "00" -> "10" and "10" -> "01" to produce the largest possible binary number (by decimal value); compute that maximum string. The challenge is to reason about how these local moves shift and merge zeros so you can derive the unique optimal arrangement efficiently for lengths up to 1e5.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.