Kotlin Leetcode - 1678. Goal Parser Interpretation
class Solution {
fun interpret(command: String): String {
}
}
解題思路
這一題考的是對字串的處理
邏輯非常單純
可以直接用字串的 replace()
處理
Kotlin 參考解答
用 replace()
處理的作法如下
class Solution {
fun interpret(command: String) = command.replace("()","o").replace("(al)","al")
}
回到 leetcode 列表