题解 | #二进制取反#
二进制取反
https://www.nowcoder.com/practice/4ca47baf4d5f4417afc0f99d6efc7d42
class Solution { public: string maxLexicographical(string num) { int i = 0; while(num[i]=='1') i++; while(num[i]=='0') num[i++]='1'; return num; } };
二进制取反
https://www.nowcoder.com/practice/4ca47baf4d5f4417afc0f99d6efc7d42
class Solution { public: string maxLexicographical(string num) { int i = 0; while(num[i]=='1') i++; while(num[i]=='0') num[i++]='1'; return num; } };
相关推荐