Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 현대sw
- java
- baekjoon
- programers
- VSCode
- 머신러닝
- 알고리즘
- SWIFT
- 코테
- 소프티어
- 안드로이드
- GDSC
- 자바
- 다트
- 개발
- 백준
- 파이썬
- DART
- Flutter
- Python
- 프로그래머스
- 플러터
- 스위프트
- kotlin
- MVVM
- 코틀린
- softeer
- aws
- Android
- 아마존 웹 서비스
Archives
- Today
- Total
조준장 개발자 생존기
[programers] 프로그래머스(코틀린) : 기능 개발 본문
문제
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
알고리즘
- 반복문을 통해 기능을 개발시킨다.
- 개발되는 매 순간 진도가 100 이상이 되면 기능들을 배포하고 배포한 값을 answer에 추가한다.
코드
class Solution {
fun solution(progresses: IntArray, speeds: IntArray): IntArray {
var answer = mutableListOf<Int>()
val progressesCopy = progresses.toMutableList()
val speedsCopy = speeds.toMutableList()
while (progressesCopy.size != 0){
speedsCopy.forEachIndexed { idx, e ->
progressesCopy[idx] += e
}
var cnt = 0
while (progressesCopy[0] >= 100){
progressesCopy.removeAt(0)
speedsCopy.removeAt(0)
cnt++
if (progressesCopy.size == 0){
break
}
}
if (cnt > 0){
answer.add(cnt)
}
}
return answer.toIntArray()
}
}
github
GitHub - junjange/KotlinAlgorithm: 내가 푼 코딩 테스트 문제와 해결법(Kotlin)
내가 푼 코딩 테스트 문제와 해결법(Kotlin). Contribute to junjange/KotlinAlgorithm development by creating an account on GitHub.
github.com
'CodingTest > Programers' 카테고리의 다른 글
[programers] 프로그래머스(파이썬) : 내적 (0) | 2022.09.21 |
---|---|
[programers] 프로그래머스(파이썬) : 정수 삼각형 (0) | 2022.09.18 |
[programers] 프로그래머스(코틀린) : 없는 숫자 더하기 (0) | 2022.09.07 |
[programers] 프로그래머스(파이썬) : 없는 숫자 더하기 (0) | 2022.09.07 |
[programers] 프로그래머스(파이썬) : 성격 유형 검사하기 (1) | 2022.09.04 |