What if the elements were not sorted like 1 3 12 what if they were 0,3,1,0,12 how do we sort them after
@pulkitchhajed3481 Жыл бұрын
by selection sort
@mohdsaadalikhan72093 жыл бұрын
how could we solve the follow-up part of this ques?
@jsuryakt3 жыл бұрын
You can remove the while loop and make the nums[i] = 0 after nums[j++] = nums[i] and only when i !=j So it'lll be like if nums[i] != 0: nums[j] = nums[i] if i != j: nums[i] = 0 j += 1
@IitTechnologyOfficial8 ай бұрын
Please provide a video in Hindi
@vaishnavirathore5579 Жыл бұрын
class Solution { public void moveZeroes(int[] nums) { int a[]=new int [nums.length]; int k=0,count=0; for(int i=0;i
@ankitkumarghosh4623 жыл бұрын
else { nums[j]=0; j++; } why this gives wrong answer
@mohammadfraz3 жыл бұрын
Can you send full code ?
@ankitkumarghosh4623 жыл бұрын
@@mohammadfraz yes class Solution { public: void moveZeroes(vector& nums) { int n = nums.size(); int j=0; for(int i =0;i
@mohammadfraz3 жыл бұрын
@@ankitkumarghosh462 Okay , take an example and try to dry run it in your code you will find the problem