๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๊ณณ๊ฐ„์—์„œ ์ธ์‹ฌ๋‚œ๋‹ค/์Šคํ„ฐ๋””

(6)
[๋ฉด์ ‘] ์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœ์ž ์˜์–ด ๋ฉด์ ‘ ์‹œ ์ž์ฃผ ์“ฐ์ผ ์ˆ˜ ์žˆ๋Š” ์˜๋‹จ์–ด ์ถœ์ฒ˜ChatGPT๋‚˜๊ธฐ์ˆ  ๊ด€๋ จ ์šฉ์–ดLifecycle - ์•ฑ ์ปดํฌ๋„ŒํŠธ์˜ ์ƒ๋ช…์ฃผ๊ธฐ ๊ด€๋ฆฌ, ์•กํ‹ฐ๋น„ํ‹ฐ/ํ”„๋ž˜๊ทธ๋จผํŠธ ์ƒ๋ช…์ฃผ๊ธฐ ๊ด€๋ จ ์งˆ๋ฌธ์—์„œ ์‚ฌ์šฉ"Understanding the lifecycle of activities and fragments is essential for managing Android app resources effectively."Architecture - ์•ฑ์˜ ๊ตฌ์กฐ๋‚˜ ํŒจํ„ด์„ ์„ค๋ช…ํ•  ๋•Œ (์˜ˆ: MVVM, MVI)"Our team implemented Clean Architecture to make the codebase modular and easily testable."Clean Architecture follows SOLID principles, which reduce coupling, im..
[Kotlin] ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜ & ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜ ๊ตฌํ•˜๊ธฐ ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜ GCD(Greatest Common Divisor) ์œ ํด๋ฆฌ๋“œํ˜ธ์ œ๋ฒ• ์ด์šฉ fun gcd(num1: Int, num2: Int): Int { return if (num2 == 0) num1 else gcd(num2, num1 % num2) } ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜ LCM(Least Common Multiple) ์ตœ์†Œ๊ณต๋ฐฐ์ˆ˜ = ๋‘ ์ž์—ฐ์ˆ˜์˜ ๊ณฑ / ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜ fun lcm(num1: Int, num2: Int): Int { return num1 * num2 / gcd(num1, num2) }
[Kotlin][Java] ByteArrays๋ฅผ 16์ง„์ˆ˜(Hex) String์œผ๋กœ ๋ณ€ํ™˜ https://www.baeldung.com/kotlin/byte-arrays-to-hex-strings ์—ฌ๊ธฐ์— ์ •๋ง ์ž˜ ๋‚˜์™”์Œ. ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์ด ์กด์žฌํ–ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋‹ค์Œ์˜ ๋ฐฉ๋ฒ•์— ์ฃผ๋ชฉํ–ˆ๋‹ค. https://www.baeldung.com/kotlin/byte-arrays-to-hex-strings val hexChars = "0123456789abcdef".toCharArray() fun ByteArray.toHex4(): String { val hex = CharArray(2 * this.size) this.forEachIndexed { i, byte -> val unsigned = 0xff and byte.toInt() hex[2 * i] = hexChars[unsigned / 16] hex[2 * i..
[์ž๋ฃŒ๊ตฌ์กฐ] ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ ๋‹จ์ผ ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ ๋…ธ๋“œ ๊ตฌ์„ฑ : ๋ฐ์ดํ„ฐ + link(๋‹ค์Œ ๋…ธ๋“œ์— ๋Œ€ํ•œ ์—ฐ๊ฒฐ ๊ณ ๋ฆฌ. ํฌ์ธํ„ฐ ํ˜น์€ ๋ ˆํผ๋Ÿฐ์Šค) ์ฒซ ๋ฒˆ ์งธ ๋…ธ๋“œ : ํ—ค๋” header ๋งˆ์ง€๋ง‰ ๋…ธ๋“œ : ๊ผฌ๋ฆฌ tail. link๋Š” ๋น„์›Œ๋‘๊ฑฐ๋‚˜ null๋กœ ์ง€์ •ํ•จ ๋…ธ๋“œ์˜ link๋Š” ๋‹ค์Œ ๋…ธ๋“œ๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” ํฌ์ธํŠธ๋‚˜ ๋ ˆํผ๋Ÿฐ์Šค๋กœ๋งŒ ๊ตฌ์„ฑ๋จ. ๊ทธ๋ž˜์„œ ์•ž์œผ๋กœ๋งŒ ์ข…์ฃผ ๊ฐ€๋Šฅ ๋ฆฌ์ŠคํŠธ๋ฅผ ์™„์ • ์ข…์ฃผํ•˜๋ ค๋ฉด ํ•ญ์ƒ ์ฒซ ๋ฒˆ์งธ ์›์†Œ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด์•ผ ํ•œ๋‹ค. ๋ฆฌ์ŠคํŠธ์— ์žˆ๋Š” ๋ชจ๋“  ์›์†Œ์˜ ์œ„์น˜๋ฅผ ํŒŒ์•…ํ•˜๋ ค๋ฉด ๋ฆฌ์ŠคํŠธ์˜ ์ฒซ ๋ฒˆ์งธ ์›์†Œ์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ๋‚˜ ๋ ˆํผ๋Ÿฐ์Šค๊ฐ€ ์žˆ์–ด์•ผ ํ•œ๋‹ค. ์ฒซ ๋ฒˆ์žฌ ์›์†Œ์˜ ํฌ์ธํ„ฐ๋‚˜ ๋ ˆํผ๋Ÿฐ์Šค๋Š” ๋ณดํ†ต ๋ณ„๋„์˜ ์ž๋ฃŒ๊ตฌ์กฐ์— ์ €์žฅํ•จ. ๋…ธ๋“œ. ์ฝ”ํ‹€๋ฆฐ์œผ๋กœ ์ž‘์„ฑ class SinglyLinkedListElement(val value: T, var next: SinglyLinkedListElemen..
[Kotlin] Selection Sort ์ง€์ •ํ•œ ์ž๋ฆฌ์— ํƒ์ƒ‰ ๋ฒ”์œ„(๋น„๊ต ๋Œ€์ƒ)์—์„œ ์ฐพ์€ ๋งž๋Š” ๊ฐ’(๊ฐ€์žฅ ์ž‘๊ฑฐ๋‚˜, ๊ฐ€์žฅ ํฌ๊ฑฐ๋‚˜)์„ ์ฐพ์•„ ๋„ฃ๋Š”๋‹ค. ๊ธฐ๋ณธ swap fun ArrayList.swap(firstIndex: Int, secondIndex: Int) { val temp = this[firstIndex] this[firstIndex] = this[secondIndex] this[secondIndex] = temp } Selection Sort fun ArrayList.selectionSort(showLog: Boolean = true) :ArrayList { if (this.size < 2) { println("๋ฐฐ์—ด ํฌ๊ธฐ : ${this.size}. ๋ฐฐ์—ด ๊ทธ๋Œ€๋กœ ๋ฐ˜ํ™˜") return this } for (currentPosition in 0 u..
[Kotlin]Bubble Sort ์ธ์ ‘ํ•œ ๋‘ ๊ฐœ์˜ ์š”์†Œ๋“ค์„ ๋น„๊ตํ•˜๋ฉฐ ์ •๋ ฌํ•œ๋‹ค. ๊ธฐ๋ณธ swap fun ArrayList.swap(firstIndex: Int, secondIndex: Int) { val temp = this[firstIndex] this[firstIndex] = this[secondIndex] this[secondIndex] = temp } Bubble sort fun ArrayList.bubbleSort(showLog: Boolean = true) : ArrayList { if (this.size < 2) { println("๋ฐฐ์—ด์˜ ํฌ๊ธฐ๊ฐ€ 2 ๋ฏธ๋งŒ. ๊ทธ๋Œ€๋กœ ๋ฐ˜ํ™˜.") return this } for (end in lastIndex downTo 1) { var swapped = false for(current in 0 un..