โœ๏ธ ์ฝ”ํ…Œ ์ค€๋น„/String

โœ๏ธ ์ฝ”ํ…Œ ์ค€๋น„/String

[๋ฌธ์ž์—ด / Kotlin] 2019 ์นด์นด์˜ค ๊ฐœ๋ฐœ์ž ๊ฒจ์šธ ์ธํ„ด์‹ญ - ํŠœํ”Œ

๋ฌธ์ œ ํ’€์ด ์–ธ์–ด Kotlin ์ฝ”๋“œ class Solution { fun solution(s: String): IntArray { val string = s.slice(2 until s.length - 2) val array = string.split("},{") val sortedArray = array.sortedBy { it.length } val answer = mutableListOf() for (e in sortedArray) { val splitString = e.split(',') for (num in splitString) { if (answer.contains(num.toInt()).not()) answer.add(num.toInt()) } } return answer.toIntArray..

โœ๏ธ ์ฝ”ํ…Œ ์ค€๋น„/String

[๋ฌธ์ž์—ด / Kotlin] 2019 KAKAO BLIND RECRUITMENT - ์˜คํ”ˆ์ฑ„ํŒ…๋ฐฉ

๋ฌธ์ œ ํ’€์ด ์–ธ์–ด Kotlin ์ฝ”๋“œ class Solution { fun solution(record: Array): Array { val history = arrayListOf() val name = mutableMapOf() val result = arrayListOf() for (e in record.iterator()) { val act = e.split(" ") when (act[0]) { "Enter" -> { name[act[1]] = act[2] history.add(Pair(act[0], act[1])) } "Leave" -> { history.add(Pair(act[0], act[1])) } "Change" -> { name[act[1]] = act[2] } } } history.map ..

โœ๏ธ ์ฝ”ํ…Œ ์ค€๋น„/String

[๋ฌธ์ž์—ด / Kotlin] 2020 KAKAO BLIND RECRUITMENT - ๋ฌธ์ž์—ด ์••์ถ•

ํ’€์ด ์–ธ์–ด Kotlin ์ฝ”๋“œ fun solution(s: String): Int { var minLength = s.length for (i in 0 until s.length / 2) { var subString = s.slice(0..i) var answer = "" var cnt = 1 var last = 0 for (j in i + 1 until s.length - i step i + 1) { // ๋งˆ์ง€๋ง‰ Index ๋ฅผ ์ €์žฅํ•œ๋‹ค. last = j + i + 1 // ๊ฐ™์€ SubString ์ธ ๊ฒฝ์šฐ ์ด๋ฅผ ์นด์šดํŠธํ•œ๋‹ค. if (subString == s.slice(j..j + i)) cnt += 1 // ๋‹ค๋ฅธ SubString ์ธ ๊ฒฝ์šฐ else { if (cnt > 1) { // ์ˆซ์ž + SubStri..

kodo_o
'โœ๏ธ ์ฝ”ํ…Œ ์ค€๋น„/String' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก