0
点赞
收藏
分享

微信扫一扫

题目:1929.数组串联

栖桐 2023-07-13 阅读 44
leetcodejava

​​题目来源:

        leetcode题目,网址:1929. 数组串联 - 力扣(LeetCode)

解题思路:

       按要求串联即可。

解题代码:

class Solution {
    public int[] getConcatenation(int[] nums) {
        int[] res=new int[nums.length*2];
        for(int i=0;i<res.length;i++){
            res[i]=nums[i%nums.length];
        }
        return res;
    }
}
 

总结:

        官方题解只给了一个按要求串联的解法。

        concatenation         串联


举报

相关推荐

0 条评论