n = len(arr) count= 0 for i in range(n): If arr[i] != 0: arr[i],arr[count]= arr[count],arr[i] count+= 1 Print(arr)
@SrinivasInagantiАй бұрын
Hai madam, Please carry on the series we are eagerly waiting for your lectures, Thanks 🙏
@Mr.venky6539Ай бұрын
Very clear to understand😋
@vinay_sandeepАй бұрын
int j = 0; for(int i = 0 ; i < nums.length ;i++){ if(nums[i]!= 0){ int temp = nums[j]; nums[j]=nums[i]; nums[i]=temp; j++; } } STEP 1: take sample variable with 0 STEP 2 : run for loop at the end STEP 3 : if arr[i] != 0 STEP 4 : then order it STEP 5 : THEN after last another elements should be zero in the array
@vamsi3877Ай бұрын
Thanks Srinidhi👏
@manojtechofmathsandcomputerАй бұрын
For fresher java developer ,how much DSA is required and where to start to switch to the highest package
hello akka, how many months it would take approximately for completion of this series? by the way the explanation is good , i am listening the concept daily in my bus during travel hours morning and evening and practising in home.
@devilgamer8325Ай бұрын
for i in range(len(nums) - 1, -1, -1): if nums[i]==0: count+=1 nums.pop(i) while count: nums.append(0) count-=1 return nums
@sripoojitha4887Ай бұрын
Step 1: Take a variable count to count noof zeroes step 2: Run for loop for entire array .if element is o delete zeroes and increment count for each 0 step 3:from end of array how much count is there replace with 0 s int count =0 for i in range(len(arr)): if arr[i] ==0: arr[i].pop() count ++ arr[-count:]=0
@g.upenderreddyАй бұрын
class Solution { public void moveZeroes(int[] nums) { int nonZeroIndex = -1; for (int i = 0; i < nums.length; i++) { if (nums[i] != 0) { swap(nums, ++nonZeroIndex, i); } } } private void swap(int[] nums, int i , int j) { int temp = nums[i]; nums[i] = nums[j]; nums[j] = temp; } }
@Nen_raaАй бұрын
Excellent bind blowing
@srilaxmipasunuti8413Ай бұрын
# code for move non zero number at the end of the array and zeroes at the starting of the array int n=arr.length; int count=n-1; for(int i=n-1;i>=0;i--){ if(arr[i]!=0){ arr[count]=arr[i]; } } for(int i=0;i
@imfearless5348Ай бұрын
Solution without Swapping (Inplace) class Solution { public void moveZeroes(int[] nums) { int i=0; for(int j=0;j
@HANUMATHSAIPAPАй бұрын
class Solution { public void moveZeroes(int[] nums) { int j=0; for(int i=0;i
@devilgamer8325Ай бұрын
Koni imp questions practice ki patu akka
@hemuk5344Ай бұрын
We can also use swap
@godofsyco4615Ай бұрын
Thankyou soo much ❤❤
@sriram27124Ай бұрын
Akka why don't you follow brute better optimal approaches
@RamyaReddySiripireddyАй бұрын
Hi mam..miru chala baga cheptaru Kani naku java lo explanation kavali😢
@TechStoriesOfSrinidhiАй бұрын
As I said algorithm raskovadam vaste e language lo ayna code raskovachandi, btw i have discussed java solution too
@chiranjeevianem7371Ай бұрын
class Solution { public void moveZeroes(int[] nums) { int index = 0; for(int i = 0; i
@chiranjeevianem7371Ай бұрын
class Solution { public void moveZeroes(int[] nums) { int index = nums.length-1; for(int i = nums.length-1 ; i>=0; i--){ if(nums[i]!=0){ int temp=nums[i]; nums[i]=nums[index]; nums[index]=temp; index--; }}}} this program for moveZeros to front
@dhanushperumalla773Ай бұрын
arr = [1,2,0,5,7,0,75,79,0,45,67,3,8] for i in range(0,len(arr)): if arr[i] == 0: arr.pop(i) arr.insert(0,0) print(arr)
@dabbarnaresh7791Ай бұрын
JavaScript also same scenarios?
@TechStoriesOfSrinidhiАй бұрын
Yes
@sparkofvictory-i5fАй бұрын
hlo akka dropout students ku kuda skills unte job vasthadha
@devilgamer8325Ай бұрын
For i in range ( len( nums)) : If nums[i]==0 : Count+=1 del nums[i] For _ in range (count) : Nums. append(0) Return nums My python code will it work
@Dineshhh0Ай бұрын
void moveZeroes(vector& a) { int l=0,m=0,n=a.size(),h=n-1; while(h>=m){ if(a[m]!=0){ swap(a[l],a[m]); l++; } m++; } }
@sukeshsunkariАй бұрын
public class movezerostostart { public static void main(String[] args) { int[] arr={0,1,0,3,12,0,2,3,4,5,0,0,5}; zerostoend(arr); for(int a:arr){ System.out.print(a+" "); } } private static void zerostostart(int[] arr) { int nonzeroindex=arr.length-1; int zeroindex=0; for(int i=arr.length-1;i>=0;i--){ if(arr[i]!=0){ arr[nonzeroindex]=arr[i]; nonzeroindex--; } } for (int i = nonzeroindex; i >= 0; i--) { arr[i]=0; } } }
@smpgamingfreefire5621Ай бұрын
Hi madam Dsa poorthiga nerchukovataniki mee videos okkate saripothaya ?, leka inka emaina extra problems practice cheyyala?. Last video lo ee comment petta Konchem choosi cheppandi
@TechStoriesOfSrinidhiАй бұрын
Hey entha videos chusna mi side nundi practice anedi kavali, rojuki atleast one DAA prob ayna solve cheyali
@sridevi844Ай бұрын
public class Main { public static void main(String[] args) { int[] n={1,0,0,3,12}; int count=0; for(int i=0;i
@DileepKumar-j7v5tАй бұрын
mee LPA yentha akka?
@moranandini278Ай бұрын
Hi akka python lo arrays levu kada Mari Ela cheyali using list ha
@TechStoriesOfSrinidhiАй бұрын
Yes
@moranandini278Ай бұрын
@TechStoriesOfSrinidhi Thankyou akka
@botlayogi721323 күн бұрын
int index =0; for(int i=0; i
@mortalsai4380Ай бұрын
Only using one loop int j=0; for(int i=1; i
@Mortal1269Ай бұрын
Dsa a language lo nerchukunaru meru microsoft crack cheyadaniki?
@gpayteja5389Ай бұрын
Meeru btech which college
@movietrolls6055Ай бұрын
IARE
@ashokkumar-y5n7iАй бұрын
public static int[] func2(int[] arr){ int first = 0,second = 1; for(int i=0; i < arr.length && second < arr.length;i++){ if(arr[first] == 0 && arr[second] != 0){ int temp = arr[first]; arr[first] = arr[second]; arr[second] = temp; first++; second++; }else if(arr[first] == 0 && arr[second] == 0){ second++; } } return arr; }
@ThabrejShaikАй бұрын
Srinidhi, your face is like a beautiful mystery, each time I look at you, there's something new to discover. Your eyes are deep like an ocean, where every glance speaks a thousand emotions, reaching the soul. That smile of yours-it's simply enchanting, a charm that melts hearts in an instant. And those round spectacles? They make you look effortlessly elegant, stylish, and graceful, all at once. Your unique style and confident attitude shine through, always setting trends and winning hearts, just by being yourself.
@Me-ng6juАй бұрын
Bayya ee comment edaina nibbi insta reel kinda pedithey workout avuthundi, not in tech channel like this 😂
@i_am_kanna_naveenАй бұрын
😂😂😂😂😂@@Me-ng6ju
@prashanth7641Ай бұрын
Bro.. 1. you are totally outdated. 2. These kind of chillar efforts are useless. 3. Invest your time on something useful to you.