์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- array๋ list
- ์๊ณ ๋ฆฌ์ฆ ์ธ์ฆ_1์ฃผ์ฐจ
- ๋ค์๋ด
- ๋ค์์ ๋ฆฌํ๊ธฐ
- iPortfolio
- ์ฝํ๋ฆฐ
- filternot
- ๋ค์ ์ ๋ฆฌํด์ผํจ
- ์ทจ์ค๊ธฐ๋ก
- Filter
- ์๊ณ ๋ฆฌ์ฆ ์ธ์ฆ
- ์๊ณ ๋ฆฌ์ฆ ์ธ์ฆ_2์ฃผ์ฐจ
- foldindexed
- recyclerview
- ์ฝ๋ฉํ ์คํธ
- Today
- Total
๋ชฉ๋ก์ ์ฒด ๊ธ (136)
Moments of growth
[๋ด ์ฝ๋] class Solution { fun solution(s: String): IntArray { var ss = s var len = s.length var n = 0 //0์ ๊ฐ์ var totalN = n var cnt = 0 while(ss!="1"){ for(i in ss){ if(i=='0'){ n++ } } ss = (len-n).toString(2) len = ss.length totalN += n n=0 cnt++ } return intArrayOf(cnt, totalN) } } ๋๋ฌด ๋๋ฝ๋ค.. ๋งค๊ฐ๋ณ์๋ก ๋ฐ์์จ s๋ val์ด๋ฏ๋ก var ss = s๋ก var ํํ๋ก ๋ณ๊ฒฝ s์ ๊ธธ์ด๋ฅผ len์ผ๋ก, n์ 0์ ๊ฐ์, totalN์ ์ง์์ง 0์ ์ด ๊ฐ์, cnt๋ ์ด ๋ช๋ฒ ๋ณํํ๋์ง์ด..
[๋ค๋ฅธ ์ฌ๋ ํ์ด] class Solution { fun solution(s: String): String = s.toLowerCase().split(" ").map{it.capitalize()}.joinToString(" ") } capitlize() : ๋ฌธ์์ด์ ์ฒซ ๊ธ์๋ฅผ ๋๋ฌธ์๋ก ๋ณํ joinToString() : ๋ฐฐ์ด ๋ฐ์ดํฐ ์ถ๋ ฅ ํ์ ๋ณ๊ฒฝ fun main() { var listInts = listOf("a","b","c","d") println(listInts.joinToString(separator=":", prefix ="[", postfix="]", limit = 3, truncated="...",transform={it.toUpperCase()})) } [A:B:C:...] separat..
[๋ด๊ฐ ์ง ์ฝ๋] class Solution { fun solution(s: String): String { var answer = "" // ๊ณต๋ฐฑ์ผ๋ก ์๋ผ์ ๋ฆฌ์คํธ์ ์ ์ฅํ๊ธฐ var token = s.split(' ') // intํ ArrayList ๋น ๋ฐฐ์ด var token2 = ArrayList() // ๋ฆฌ์คํธ ์์ ๊ฐ intํ์ผ๋ก ๋ณ๊ฒฝ for(i in token){ token2.add(i.toInt()) } // ๋ฆฌ์คํธ ์์์ ์ค๋ฆ์ฐจ์ ์ ๋ ฌํ๊ธฐ var sorted = token2.sorted() // ๋ฆฌ์คํธ ์ฒซ๋ฒ์งธ ๊ฐ๊ณผ ๋ง์ง๋ง ๊ฐ ๋ถ์ด๊ธฐ answer = sorted[0].toString() + " " + sorted.last().toString() return answer } } [๋ค๋ฅธ ์ฌ๋ ํ..
๋ณดํธ๋์ด ์๋ ๊ธ์ ๋๋ค.
๋ณดํธ๋์ด ์๋ ๊ธ์ ๋๋ค.
๋ณดํธ๋์ด ์๋ ๊ธ์ ๋๋ค.
๋ณดํธ๋์ด ์๋ ๊ธ์ ๋๋ค.
๋ณดํธ๋์ด ์๋ ๊ธ์ ๋๋ค.