/**
* @author xnl
* @Description:
* @date: 2022/7/31 22:10
*/
public class Solution {
public static void main(String[] args) {
Solution solution = new Solution();
}
public int[] getConcatenation(int[] nums) {
int n = nums.length;
int[] ans = new int[n * 2];
for (int i = 0; i < n; i++){
ans[i] = nums[i];
ans[i + n] = nums[i];
}
return ans;
}
}
力扣:数组串联
于 2022-07-31 22:15:37 首次发布
本文主要介绍了Java中实现数组连接的getConcatenation方法。该方法将输入数组复制并拼接成一个新的双倍长度数组。示例代码展示了如何创建并使用这个方法。

442

被折叠的 条评论
为什么被折叠?



