Move Zeros To The end of Array❗❗ | Hello world Programming Logic Easy | Hindi Explained

  Рет қаралды 22,064

Hello World

Hello World

2 жыл бұрын

This is the video under the series of DATA STRUCTURE & ALGORITHM. Now we are going to solve Move Zeroes under Array sections
Join My Telegram channel for more Updates: telegram.me/helloworldbyprince
complete DSA preparation: github.com/Prince-1501/Comple...
----------------------------------------------------------------------------------------
Move Zeroes: leetcode.com/problems/move-ze...
code of Move Zeroes: github.com/Prince-1501/Hello_...
----------------------------------------------------------------------------------------
*Follow me *
LinkedIn► / iamprince
Facebook► / helloworldofficials
Instagram► / helloworldbyprince
Twitter► / prince_king_
Telegram► telegram.me/helloworldbyprince
----------------------------------------------------------------------------------------
►Our Playlists on:-
► Tree: • Tree Data Structure & ...
► Hashing: • Hashing Data Structure...
► Graph: • Graph Data Structure &...
► Matrix: • Matrix (Multidimension...
► STL: • Standard Template Libr...
► Leetcode: • LeetCode Solutions And...
►Competitive Programming: • Full course in Competi...
►C++ Full Course : • C++ full Course in HINDI
►Algorithms: • L-01 || Prefix Sum Arr...
►Data Structure: • Data Structures with C...
------------------------------------------------------------------------
🌟 Please leave a LIKE ❤️ and SUBSCRIBE for more AMAZING content! 🌟
✨ Tags ✨
Move Zeroes
Array playlist Hello world
Depth First Search
Array hello world
Types of graphs in Data structure & algorithms
Move Zeros To The end of Array
playlist Graph Hindi
hashing playlist Hello World
question asked in Google
off-campus placement
how to learn to code for beginners
Practice Tree data structure
Flood Fill Algorithms
The graph in a data structure in Hindi
Graph Full playlist for Beginners
algorithms
graph
dynamic programming
data structure
sorting algorithms
algorithm analysis
algorithm examples
gate computer science preparation
programming languages
#Array #Leetcode #programming

Пікірлер: 70
@bossmemes3308
@bossmemes3308 9 ай бұрын
Thanks for motivation. Initially I directly jumped into solution but you motivated to solve it and I did. My solution was not much optimized. Now watching video for proper clearance.
@HelloWorldbyprince
@HelloWorldbyprince 9 ай бұрын
You are doing really great just keep doing the work
@shivasai2014
@shivasai2014 Жыл бұрын
first, I thought let's check the solution instead of thinking about the solution but after listening to you, tried without lookin into solution and then boom got my solution🤯 public void moveZeroes(int[] nums) { int j=0; for(int i=0; i
@swatantrapatel7608
@swatantrapatel7608 2 жыл бұрын
Yes 2nd approach kri maine but code nhi ho paya .. thank u ❤️
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Amazing 😀
@iAm_Rohit_Raj
@iAm_Rohit_Raj 2 жыл бұрын
Best approach according to me :- 1) Count the number of 0s in the vector using *count(nums.begin(), nums.end(), target)* , here target = *0* 2) Remove all the 0s, *nums.erase(remove(nums.begin(), nums.end(), target), nums.end())* , target = *0* 3) Append all the 0s at the end using a for loop, *nums.push_back(0)* After submission it said, faster than 74.53% of C++ online submissions... Hope it helps !!! 😊😊😊
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
great work 👍
@MrKB_SSJ2
@MrKB_SSJ2 Жыл бұрын
I tried the same method in a platform. It gave time limit exceeded
@debankoghosh6311
@debankoghosh6311 2 жыл бұрын
void moveZeroes(vector& nums) { int c=0; for(int i=0;i
@mehulsingh1216
@mehulsingh1216 2 жыл бұрын
Same bro... i did the same...
@user-zk1nw9nu7w
@user-zk1nw9nu7w 5 ай бұрын
hogya bhaiya yeh wala, took extra array for that, would love to learn new and more efficient approaches.
@mohaseenshaikh262
@mohaseenshaikh262 10 ай бұрын
I solved it before watching ur solution
@akshaygoyal4118
@akshaygoyal4118 4 ай бұрын
var moveZeroes = function(nums) { let j=0 for(let i=0; i< nums.length; i++){ if(nums[i] == 0){ [nums[i], nums[j]] = [nums[j], nums[i]]; j++; } } return nums }; complex approach in js
@nittinrana2277
@nittinrana2277 2 жыл бұрын
Thanks brother nice explanation
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Welcome
@rahulkarmakar8067
@rahulkarmakar8067 Жыл бұрын
class Solution: def moveZeroes(self, nums: List[int]) -> None: n=len(nums) l, h=0,0 while(h
@shrodingerscat7099
@shrodingerscat7099 Жыл бұрын
suppose if array is [1,0,0,3] here intially j is 0th position of array now keep on moving i until we reach non zero value ie - 3 now swap jth position with 3 and increase value of j here ur method fails ?
@insidiousop3487
@insidiousop3487 10 ай бұрын
i also did from the same approach 😁
@HelloWorldbyprince
@HelloWorldbyprince 10 ай бұрын
nice yar Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@tarunbehera934
@tarunbehera934 Жыл бұрын
why haven't you declared " int j " in 2nd for loop ??
@nimeshsharma127
@nimeshsharma127 2 жыл бұрын
In last approach there is no need to add zeros at last if we swap i and j in the loop
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Yeah u can do that as well i guess
@TanishqaSawant
@TanishqaSawant Жыл бұрын
Swapping increases time complexity, I did it and got TLE
@arunavakirtan7621
@arunavakirtan7621 7 ай бұрын
Nice explanation but I think my solution is more efficient. def pushZerosAtEnd(arr): n = len(arr) zero_index = 0 for i in range(n): if arr[i] == 0: if i > zero_index: continue else: zero_index = i else: if zero_index < i: arr[zero_index], arr[i] = arr[i], arr[zero_index] zero_index += 1 return arr
@HelloWorldbyprince
@HelloWorldbyprince 6 ай бұрын
oo great
@oneminuteanimation-uz5yb
@oneminuteanimation-uz5yb 11 ай бұрын
bhaiya bona approach ka TC same hee hai na
@rajchandra6913
@rajchandra6913 Жыл бұрын
This is the best solution
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a ton
@PIYUSH-lz1zq
@PIYUSH-lz1zq 2 жыл бұрын
bhaiaya , you can take cf medium level questions or DP or online assesment ke questions !!
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
sure
@mehulsingh1216
@mehulsingh1216 2 жыл бұрын
Can anyone please tell the time complexity of 3rd approach? In which we are taking two pointers and checking if arr[i] is not equal to zero, then inserting it into arr[j]
@Coder_DhruvArora
@Coder_DhruvArora 2 жыл бұрын
O(n) only
@letsprogram30
@letsprogram30 8 ай бұрын
@@Coder_DhruvArorait’s O(2N) but yeah if you consider drop constant way then yes it’s O(N)
@ParaScary62
@ParaScary62 Жыл бұрын
I was incrementing the j after the if statement. That's why no changes were being happen in the array. 😑😑
@RahulGupta-hn5cl
@RahulGupta-hn5cl Жыл бұрын
I thought Second Approach and solved it.
@anujsonimca9531
@anujsonimca9531 Жыл бұрын
mne kiya tha 2nd approach se its like O(n^2)
@Rafiullahsw007
@Rafiullahsw007 Жыл бұрын
Where is the basics of these coding and what is the name of the app
@RitikKumar-bk6pj
@RitikKumar-bk6pj 11 ай бұрын
Bhaiya 2nd approach s kiya th code per wo fs gyi test cases mai
@ashutoshverma4638
@ashutoshverma4638 10 ай бұрын
swapping method is faster in both time and space complexity.
@HelloWorldbyprince
@HelloWorldbyprince 9 ай бұрын
Hmm
@user-rv3sz7fz5l
@user-rv3sz7fz5l 7 ай бұрын
Hi, I am from Pakistan........I am new to this leetcode ,I have only theoretical knowledge I have never implement such type of question ...what I do??? I am seeing your videos from the last three days .... I understand the question but can't think about approaches and more sad part is that also can't Implement code ....kindly suggest me how to be good at it ... Because I want to be good in it in 3 months......
@HelloWorldbyprince
@HelloWorldbyprince 7 ай бұрын
Okay trust me and just start from my Playlist one by one 1. Hashing 2. Linked List 3. Stack and Queue 4. Heap 5. Tree 6. Graph Do whatever I said in the video and follow every instruction strictly. Each of my videos is based on one Question just try and learn from my videos and after completion of each Data structure just ping me over LinkedIn or KZbin comment section and jo v videos dekhte ho, put comments on that video so that I can also track your progress
@user-rv3sz7fz5l
@user-rv3sz7fz5l 7 ай бұрын
@@HelloWorldbyprince sure...!... Can I ask how you learned because you have such a clear concepts and approaches?
@anoopshetty3580
@anoopshetty3580 Жыл бұрын
let temp = 0; for(let i=0; i
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
koi issue nahi its nice
@anoopshetty3580
@anoopshetty3580 Жыл бұрын
@@HelloWorldbyprince Thank you very much sir
@pain9569
@pain9569 11 ай бұрын
Complexity is O(n^2), could be optimized
@rajasaraf6602
@rajasaraf6602 6 ай бұрын
merese hua tha lekin n2 complexity se
@sakshiawadhiya7267
@sakshiawadhiya7267 2 жыл бұрын
Sir jo questions companies me aate hai geeksforgeeks me questions karwa digieye
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Sure dude
@comp_rohityadav145
@comp_rohityadav145 Жыл бұрын
Ho gya solve but Space complexity is O(n)
@user-ie3lx2zc2n
@user-ie3lx2zc2n Жыл бұрын
second approch hum soche the
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
nice yaar good job
@nadeemmehraj5873
@nadeemmehraj5873 Жыл бұрын
Bhaiya 5 bar attempted kiya or her baar naya constraint lagana pada phir bhi nahi hua
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
kya probelm aa rha hai aap batao ? mere code se kya alag hai ?
@oneminuteanimation-uz5yb
@oneminuteanimation-uz5yb 11 ай бұрын
bhaiya swap wela approach and last wela same time complexity hai hee too hoo reha hai na
@gauravparasar4571
@gauravparasar4571 Жыл бұрын
5:27 solve ke naam pr mene decreasing order me sort krne ka socha 😢😢😢😢
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
yup, dhere dhere concept aur strong ho jayega relax
@harshvardhanpande8409
@harshvardhanpande8409 2 жыл бұрын
I though 2nd approch
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
waoo yaar good
@TheDailyProphet789
@TheDailyProphet789 Жыл бұрын
first approah ki code hai kisi ke pass
@rakeshdharne4517
@rakeshdharne4517 8 ай бұрын
ho gaya
@HelloWorldbyprince
@HelloWorldbyprince 8 ай бұрын
Nice
@vritra1537
@vritra1537 2 жыл бұрын
Nahi bana merse
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
koi na bro dhere dhere ban jayega
@havefun8544
@havefun8544 Жыл бұрын
Sort kardo and reverse it
@anjanishrivastava1273
@anjanishrivastava1273 5 ай бұрын
KHUDA KA KASTA KYON BOLA JAI SHRI RAM BOLO KATALU
Final muy increíble 😱
00:46
Juan De Dios Pantoja 2
Рет қаралды 50 МЛН
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 4,7 МЛН
Move Zeroes - Leetcode 283 - Python
8:15
NeetCode
Рет қаралды 67 М.
Shift All Zero Elements to Right Side of the Array - Java interview Question
15:05
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 614 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 310 М.
Final muy increíble 😱
00:46
Juan De Dios Pantoja 2
Рет қаралды 50 МЛН