leetcode : Add Binary
runtime 0 ms, beats 100% of cpp submissions
O(m+n) solution with explanation
tags: string
š link
š description
ēµ¦å®å ©å 01 é£å aćb ļ¼č«ę±å°å ©č ēøå ä¹ę°ēåäø²åå³ć
ex. Input: a = "1010", b = "1011" Output: "10101"
š§ solution
ę ¹ęé”ęęØ”ę¬äøꬔčØē®ļ¼åŖéč¦ę³Øęé”å¤čēé²ä½å ¶ę³å³åÆć
ā³ time complexity
éę·å
©ååäø²ļ¼ęéč¤éåŗ¦ O(m+n) ļ¼å
¶äø m, n 代č”Øå
©ååäø²ēé·åŗ¦ć
ēø½ęéč¤éåŗ¦ O(m+n)
š code
1 | class Solution { |