본문 바로가기

프로그래머스 Algorithm60

[프로그래머스] 의상 풀이 Kotlin 안녕하세요. 이번에는 프로그래머스 의상 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/42578 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution class Solution { fun solution(clothes: Array): Int { var answer = 1 clothes.groupBy { it[1] }.forEach { answer *= (it.value.size + 1) } return answer - 1 } } 이번 문제는 Grou.. 2024. 1. 23.
[프로그래머스] 행렬의 곱셈 풀이 Kotlin 안녕하세요. 이번에는 프로그래머스 행렬의 곱셈 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/12949 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution class Solution { fun solution(arr1: Array, arr2: Array): Array { var answer = Array(arr1.size) { IntArray(arr2[0].size) } for(i in arr1.indices) { for(j in answer[i].. 2024. 1. 19.
[프로그래머스] 모의고사 풀이 Kotlin 안녕하세요. 이번에는 프로그래머스 모의고사 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/42840# 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution import kotlin.math.max class Solution { fun solution(answers: IntArray): IntArray { var answer = intArrayOf() val one = listOf(1, 2, 3, 4, 5) val two = listOf(2, 1, 2.. 2024. 1. 17.
[프로그래머스] 과일장수 풀이 Kotlin 안녕하세요. 이번에는 프로그래머스 과일 장수 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/135808 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution class Solution { fun solution(k: Int, m: Int, score: IntArray): Int { var answer: Int = 0 val boxNum = score.size / m val sortedScore = score.sortedDescending() for(.. 2024. 1. 16.
[프로그래머스] 2016년 Kotlin 안녕하세요. 이번에는 프로그래머스 2016년 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/138476 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution class Solution { fun solution(a: Int, b: Int): String { var answer = "" var arr = arrayOf("THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED") var manthToDay = arrayOf(0.. 2024. 1. 14.
[프로그래머스] H-Index Kotlin 안녕하세요. 이번에는 프로그래머스 H-Index 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/42747 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution class Solution { fun solution(citations: IntArray): Int { val sortedCitations = citations.sorted() var max = 0 for(i in sortedCitations.size - 1 downTo 0) { val min.. 2024. 1. 13.
[프로그래머스] n^2 배열 자르기 Kotlin 안녕하세요. 이번에는 프로그래머스 n^2 배열 자르기 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/87390 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution import kotlin.math.max class Solution { fun solution(n: Int, left: Long, right: Long): IntArray { var answer: IntArray = intArrayOf() (left..right).forEach { ans.. 2024. 1. 10.
[프로그래머스] 할인 행사 Kotlin 안녕하세요. 이번에는 프로그래머스 할인 행사 문제를 풀어보려고 합니다. Problem https://school.programmers.co.kr/learn/courses/30/lessons/131127 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution class Solution { fun solution(want: Array, number: IntArray, discount: Array): Int { var answer: Int = 0 var hashMap = HashMap() want.forEachIndexed { i, string -> h.. 2024. 1. 4.
반응형