알고리즘/문제(35)
-
프로그래머스 알고리즘 Level 1 숫자 짝궁 코틀린
https://school.programmers.co.kr/learn/courses/30/lessons/131128 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 - 성공 class Solution { fun solution(X: String, Y: String): String = X.filter { Y.contains(it) } .groupBy { it } .map {if (it.value.size < Y.groupBy { it }[it.key]!!.size) it.value else Y.groupBy { it }[it.key]!!} .flatte..
2023.01.27 -
프로그래머스 알고리즘 Level 1 ( 2019 KAKAO BLIND RECRUITMENT 실패율 문제 )
https://school.programmers.co.kr/learn/courses/30/lessons/42889#qna 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 - 성공 class Solution { fun solution(N: Int, stages: IntArray): IntArray { var answer = intArrayOf() val failureRateList = mutableListOf() for (i in 1..N) { if (stages.count { it >= i } == 0) { failureRateList.add(0.0)..
2023.01.26 -
프로그래머스 알고리즘 Level 1 체육복
https://school.programmers.co.kr/learn/courses/30/lessons/42862 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 - 성공 class Solution { fun solution(n: Int, lost: IntArray, reserve: IntArray): Int { var answer = 0 val lostList = lost.filterNot { reserve.contains(it) }.sorted().toMutableList() val reserveList = reserve.filterNot { lo..
2023.01.26 -
프로그래머스 알고리즘 Level 1 2019 카카오 개발자 겨울 인턴쉽 크레인 인형뽑기 게임
https://school.programmers.co.kr/learn/courses/30/lessons/64061 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 - 성공 class Solution { fun solution(board: Array, moves: IntArray): Int { var answer = 0 val list = mutableListOf() for (moveIndex in moves.indices) { val moveColumn = moves[moveIndex] - 1 for (itemRow in board.indices) {..
2023.01.25 -
프로그래머스 알고리즘 Level 1 코틀린 2021 KAKAO BLIND RECRUITMENT신규 아이디 추천
https://school.programmers.co.kr/learn/courses/30/lessons/72410 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 - 성공 class Solution { fun solution(new_id: String): String { val new = new_id.lowercase() .replace("[^a-z0-9_.-]".toRegex(),"") .replace("[.]{2,}".toRegex(), ".") .replace("^[.]|$[.]".toRegex(),"") .let { it.ifEmpty { "a..
2023.01.25 -
프로그래머스 알고리즘 Level 1 코틀린 2022 카카오 TECH INTENSHIP 성격 유형 검사하기 문제
https://school.programmers.co.kr/learn/courses/30/lessons/118666 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 - 성공 class Solution { fun solution(survey: Array, choices: IntArray): String { var answer: String = "" val name = arrayOf("R", "T", "C", "F", "J", "M", "A", "N") val score = intArrayOf(3, 2, 1, 0, 1, 2, 3) val table = L..
2023.01.25