Development/Algorithm

[LeetCode] 11. Container With Most Water (Kotlin)
https://leetcode.com/problems/container-with-most-water/ Container With Most Water - 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 import kotlin.math.max import kotlin.math.min class Solution { fun maxArea(height: IntArray): Int { var answer = 0 var left = 0 var right = height.si..

[LeetCode] 10. Regular Expression Matching (Kotlin)
https://leetcode.com/problems/regular-expression-matching/ Regular Expression Matching - 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 isMatch(s: String, p: String): Boolean { if (p.isEmpty()) { return s.isEmpty() } val isFirstMatch = s.isNotEmpty() && listOf..

[LeetCode] 8. String to Integer (atoi) (Kotlin)
https://leetcode.com/problems/string-to-integer-atoi/ String to Integer (atoi) - 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 myAtoi(s: String): Int { var answer = "" var isFirstLeading = true var signNumber = 0 for (i: Int in s.indices) { val ch = s[i] if (..

[LeetCode] 7. Reverse Integer (Kotlin)
https://leetcode.com/problems/reverse-integer/ Reverse 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 import kotlin.math.abs import kotlin.math.pow class Solution { fun reverse(x: Int): Int { var answer = 0 var xNum = x var cnt = abs(x).toString().length - 1 while (xNum ..

[LeetCode] 6. Zigzag Conversion (Kotlin)
https://leetcode.com/problems/zigzag-conversion/ Zigzag Conversion - 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 convert(s: String, numRows: Int): String { var direction = 0 var zigzagIdx = 0 val zigzagTable = mutableMapOf() s.forEach { if (zigzagIdx == 0) ..