Kotlin Leetcode - 3925. Concatenate Array With Reverse
題目連接:https://leetcode.com/problems/concatenate-array-with-reverse/
class Solution {
fun concatWithReverse(nums: IntArray): IntArray {
}
}
解題思路
這題目是陣列相關操作
透過 Kotlin 內建的 reversedArray()
可以很快的處理掉這一題
Kotlin 參考解答
點擊展開解答
class Solution {
fun concatWithReverse(nums: IntArray): IntArray {
return nums + nums.reversedArray()
}
}
- 回到 leetcode 列表