Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
49. Group Anagrams
Complexities π
Explanation π
"good"
κ³Ό"god"
μ΄ κ°μ΄ λ¬Άμ΄λ λ¬Έμ μ μ λ°κ²¬190. Reverse Bits
Complexities π
Explanation π
a. 2μ§μλ₯Ό λ¬Έμμ΄λ‘ λ³ν β λ¬Έμμ΄μ κ±°κΎΈλ‘ λ³ν β prefixκ° 0μ΄μ΄μ μΆμ½λ κΈΈμ΄λ§νΌ suffixμ 0μ νμ₯ β μ μνμ μΌλ‘ λ³ν λ° λ¦¬ν΄
b. κ° λΉνΈλ§λ€ μ¬ννΈ μ°μ°(
<<
,>>
)κ³Ό μ€λ μ°μ°(&
)μ νμ©νμ¬ λνκ³ λ¦¬ν΄191. Number of 1 Bits
Complexities π
Explanation π
Swiftμλ Intνμ μ λ©μλλ‘
nonzeroBitCount
λΌλ νλ‘νΌν°κ° μ‘΄μ¬ν¨, μ΄λ Swiftμμ μ체 μ 곡ν΄μ£Όλ νλ‘νΌν°λ‘, μ€μ λΉνΈ μ€ 1μ μ΄ κ°μλ₯Ό 리ν΄ν¨Swiftμμ μ 곡ν΄μ£Όλ κ²μ μ¬μ©νμ§ μμ κ²½μ°λ ꡬννμκ³ , λΉκ΅ κ²°κ³Ό μ μλ―Έν μ°¨μ΄λ μ‘΄μ¬νμ§ μμμ
Test code
268. Missing Number
Complexities π
Explanation π
[0 ... n]μμ μλ΅λ μ«μλ₯Ό ꡬν΄μΌ ν¨
μΈ κ°μ§μ λ°©λ²μ΄ λ μ€λ¦
μ λΆ κ΅¬ν ν μκ° λΉκ΅ κ²°κ³Ό, μ§§μ νμ΄μ΄κΈ° λλ¬Έμ μ€ν νκ²½μ λ°λΌ μλκ° λ¬λΌμ‘μ
338. Counting Bits
Complexities π
Explanation π
μ²μμλ Swiftμμ μ체μ 곡ν΄μ£Όλ
nonzeroBitCount
νλ‘νΌν°λ₯Ό μ¬μ©νμ¬ νμ΄ν¨νμ§λ§ dpλ‘ νμ΄ν μ μλ€λ μ¬μ€μ κΉ¨λ«κ³ μλ‘κ² νμ΄ν¨
6(110)
μ3(11)
μ 1μ κ°μ +6(110)
μ μ΅νμ λΉνΈ,3(11)
μ1(1)
μ 1μ κ°μ +3(11)
μ μ΅νμ λΉνΈ,10_000_000
μ κ°μ μ£Όκ³ νμ΄ μλ μΈ‘μ , dp νμ΄κ° νμ€ν λΉ¨λμ(μ΄μ°λ³΄λ©΄ λΉμ°ν κ±°μΌ μλ....)