Untitled
unknown
plain_text
3 months ago
527 B
3
Indexable
class Solution { public: void moveZeroes(vector<int>& nums) { for(int i=0;i<nums.size();++i) { if(nums[i]==0) { for(int j=i+1;j<nums.size();++j) { if(nums[j]!=0) { int temp=nums[j]; nums[j]=nums[i]; nums[i]=temp; continue; } } } } } };
Editor is loading...
Leave a Comment