摘要: 移动零 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 请注意 ,必须在不复制数组的情况下原地对数组进行操作。 方法1: class Solution { public void moveZeroes(int[] nums) { int i = 0; 阅读全文
posted @ 2024-07-02 23:41 直来直往1 阅读(8) 评论(0) 推荐(0)