Kotlin33 68] 프로그래머스 세균 증식 Kotlin https://school.programmers.co.kr/learn/courses/30/lessons/120910 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import kotlin.math.pow class Solution { fun solution(n: Int, t: Int): Int { var answer: Int = 0 // 시간당 늘어나는 세균 수 // int를 double로, double에서 int로 형변환 필요 answer = 2.toDouble().pow(t).toInt() // 초기 세균수에 곱하기 answer *= n return .. 2023. 3. 20. Kotlin] 문자열합치기 joinToString https://kkh0977.tistory.com/682 53. (kotlin/코틀린) joinToString 사용해서 배열 데이터 출력 형식 변경 실시 - arrayOf , ArrayList /* =========================== */ [개발 환경 설정] 개발 툴 : Eclipse 개발 언어 : kotlin /* =========================== */ /* =========================== */ [소스 코드] package ex1 //===== [코.. kkh0977.tistory.com https://themach.tistory.com/188 [Kotlin 기초] String 배열을 String으로 합치기 String Array로 형성한 데이터를.. 2022. 6. 20. 66] Kotlin 프로그래머스 / x만큼 간격이 있는 n개의 숫자 class Solution { fun solution(x: Int, n: Int): LongArray { // n 크기의 배열 선언 val answer = LongArray(n) for (i in 0 until n) { // 둘다 가능 answer[i] = (i + 1) * x.toLong() // answer.set(i, ((i+1) * x.toLong()) } return answer } } 코틀린으로 알고리즘 풀려니 헷갈려,, class Solution { fun solution(x: Int, n: Int): LongArray { // n 크기의 배열 선언 val answer = LongArray(n){i-> x.toLong() * (i + 1).toLong() } return answer } } .. 2021. 9. 28. Android] Kotlin fragment에서 상태표시줄 보여지게 https://developer.android.com/reference/android/view/WindowInsetsController WindowInsetsController | Android 개발자 | Android Developers developer.android.com 상태표시줄 보이게 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){ controller = activity!!.window.insetsController if(controller != null){ controller!!.show(WindowInsets.Type.statusBars()) } }else{ activity!!.window.clearFlags(WindowManager.Layou.. 2021. 6. 8. 이전 1 2 3 4 5 6 7 8 9 다음