Development/Algorithm

    [LeetCode] 20. Valid Parentheses (Kotlin)

    https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { fun isValid(s: String): Boolean { val stack = Stack() s.forEach { val currentBracket = it.toString() if (currentBracket.isOpenedBracket()) { stack.p..

    [LeetCode] 14. Longest Common Prefix (Kotlin)

    https://leetcode.com/problems/longest-common-prefix/ Longest Common Prefix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { fun longestCommonPrefix(strs: Array): String { if (strs.size == 1) return strs.first() var answer = "" val sortedStrs = strs.sortedBy { it.l..

    [LeetCode] 13. Roman to Integer (Kotlin)

    https://leetcode.com/problems/roman-to-integer/ Roman to Integer - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { fun romanToInt(s: String): Int { var answer = 0 for (i: Int in s.indices) { answer += if (i == s.length - 1) { RomanNumerals.get(s[i]) } else { val cu..

    [프로그래머스 코딩 테스트 연습] 스택/큐 - 프린터 (코틀린)

    https://programmers.co.kr/learn/courses/30/lessons/42587?language=kotlin 코딩테스트 연습 - 프린터 일반적인 프린터는 인쇄 요청이 들어온 순서대로 인쇄합니다. 그렇기 때문에 중요한 문서가 나중에 인쇄될 수 있습니다. 이런 문제를 보완하기 위해 중요도가 높은 문서를 먼저 인쇄하는 프린 programmers.co.kr data class Document( val priority: Int, val isTarget: Boolean ) class Solution { fun solution(priorities: IntArray, location: Int): Int { var answer = 0 val documents = priorities.mapIndexe..