1. Move Zeroes || Arrays Problem Solving

Поділитися
Вставка
  • Опубліковано 10 гру 2024

КОМЕНТАРІ • 52

  • @Arjun-hc7ow
    @Arjun-hc7ow 11 днів тому +11

    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)

  • @Mr.venky6539
    @Mr.venky6539 11 днів тому +4

    Very clear to understand😋

  • @vinay_sandeep
    @vinay_sandeep 11 днів тому +2

    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

  • @RekulapallySaiSwaranReddy2210
    @RekulapallySaiSwaranReddy2210 2 дні тому +1

    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.

  • @srilaxmipasunuti8413
    @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

  • @vamshi2nd392
    @vamshi2nd392 10 днів тому

    Good video, Easy explaination.

  • @sripoojitha4887
    @sripoojitha4887 7 днів тому

    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

  • @vamsi3877
    @vamsi3877 11 днів тому +1

    Thanks Srinidhi👏

  • @sateeshvepada8620
    @sateeshvepada8620 11 днів тому

    Thank you for your time and knowledge sharing

  • @bijjepurushotham7667
    @bijjepurushotham7667 11 днів тому

    nice video akka thanks for starting DSA series

  • @devilgamer8325
    @devilgamer8325 11 днів тому

    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

  • @umasaivigneshpeeta7890
    @umasaivigneshpeeta7890 11 днів тому +1

    NeetCode Sheet questions solve chesey Playlist Start cheyyandi Akka!!

  • @imfearless5348
    @imfearless5348 11 днів тому

    Solution without Swapping (Inplace)
    class Solution {
    public void moveZeroes(int[] nums) {
    int i=0;
    for(int j=0;j

  • @manojtechofmathsandcomputer
    @manojtechofmathsandcomputer 11 днів тому +2

    For fresher java developer ,how much DSA is required and where to start to switch to the highest package

  • @I-love-you-47
    @I-love-you-47 11 днів тому

    Excellent bind blowing

  • @godofsyco4615
    @godofsyco4615 9 днів тому

    Thankyou soo much ❤❤

  • @dhanushperumalla773
    @dhanushperumalla773 11 днів тому

    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)

  • @hemuk5344
    @hemuk5344 8 днів тому

    We can also use swap

  • @g.upenderreddy
    @g.upenderreddy 11 днів тому

    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;
    }
    }

  • @RamyaReddySiripireddy
    @RamyaReddySiripireddy 11 днів тому +1

    Hi mam..miru chala baga cheptaru Kani naku java lo explanation kavali😢

    • @TechStoriesOfSrinidhi
      @TechStoriesOfSrinidhi  11 днів тому +1

      As I said algorithm raskovadam vaste e language lo ayna code raskovachandi, btw i have discussed java solution too

  • @devilgamer8325
    @devilgamer8325 11 днів тому +1

    Koni imp questions practice ki patu akka

  • @chiranjeevianem7371
    @chiranjeevianem7371 11 днів тому

    class Solution {
    public void moveZeroes(int[] nums) {
    int index = 0;
    for(int i = 0; i

    • @chiranjeevianem7371
      @chiranjeevianem7371 10 днів тому

      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

  • @HANUMATHSAIPAP
    @HANUMATHSAIPAP 11 днів тому

    class Solution {
    public void moveZeroes(int[] nums) {
    int j=0;
    for(int i=0;i

  • @devilgamer8325
    @devilgamer8325 11 днів тому +1

    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

  • @Thedealdriver-d5h
    @Thedealdriver-d5h 11 днів тому +1

    hlo akka dropout students ku kuda skills unte job vasthadha

  • @sriram27124
    @sriram27124 7 днів тому

    Akka why don't you follow brute better optimal approaches

  • @sukeshsunkari
    @sukeshsunkari 4 дні тому

    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;
    }
    }
    }

  • @dabbarnaresh7791
    @dabbarnaresh7791 6 днів тому

    JavaScript also same scenarios?

  • @DileepKumar-j7v5t
    @DileepKumar-j7v5t 10 днів тому

    mee LPA yentha akka?

  • @Dineshhh0
    @Dineshhh0 11 днів тому

    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++;
    }

    }

  • @smpgamingfreefire5621
    @smpgamingfreefire5621 11 днів тому

    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
      @TechStoriesOfSrinidhi  11 днів тому

      Hey entha videos chusna mi side nundi practice anedi kavali, rojuki atleast one DAA prob ayna solve cheyali

  • @moranandini278
    @moranandini278 10 днів тому

    Hi akka python lo arrays levu kada
    Mari Ela cheyali using list ha

  • @gpayteja5389
    @gpayteja5389 9 днів тому

    Meeru btech which college

  • @mortalsai4380
    @mortalsai4380 11 днів тому

    Only using one loop
    int j=0;
    for(int i=1; i

  • @pramodtelugucinefacts139
    @pramodtelugucinefacts139 11 днів тому

    Python

  • @ashokkumar-y5n7i
    @ashokkumar-y5n7i 11 днів тому

    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
    @ThabrejShaik 11 днів тому

    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
      @Me-ng6ju 11 днів тому +4

      Bayya ee comment edaina nibbi insta reel kinda pedithey workout avuthundi, not in tech channel like this 😂

    • @i_am_kanna_naveen
      @i_am_kanna_naveen 11 днів тому +1

      😂😂😂😂😂​@@Me-ng6ju

    • @prashanth7641
      @prashanth7641 11 днів тому

      Bro..
      1. you are totally outdated.
      2. These kind of chillar efforts are useless.
      3. Invest your time on something useful to you.

    • @RKBOSS-8055
      @RKBOSS-8055 10 днів тому

      Wah Anna wah wah wah 😂

  • @anilgude0167
    @anilgude0167 11 днів тому +8

    Hlo bro naa comment add avvatledhu
    ...#include
    main()
    {
    int a[10],i,n,j=0,count=0,t;
    printf("enter n: ");
    scanf("%d",&n);
    for(i=0;i