Shift All Zero Elements to Right Side of the Array - Java interview Question

  Рет қаралды 24,747

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

In this video, I have explained how to Shift All Zero Element to Right Side of the Array - Java interview Question.
OR
Shift all non zero elements to left side of the array.
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
www.youtube.co...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/...
Naveen AutomationLabs Paid Courses:
Java & Selenium:
naveenautomatio...
Java & API +POSTMAN + RestAssured + HttpClient:
naveenautomatio...

Пікірлер: 28
@SceneSn1ppets
@SceneSn1ppets 3 жыл бұрын
Just 2 days back I was asked the same question in one of the top MNCs, I did it through arraylist using .add and . remove in one loop
@rajatnegi3408
@rajatnegi3408 3 жыл бұрын
Naveen Sir, I was asked this question recently. I was searching the logic but saw this video.. Thanks for helping people in the testing community.. you are a true blessing for us.. Thank you
@MrPankajchakraborty
@MrPankajchakraborty 3 жыл бұрын
Thanks Naveen, gone through all 40 videos and with most of them learnt something new. Really appreciate your efforts. please keep going and keep growing 👍
@subramanianr2744
@subramanianr2744 3 жыл бұрын
Logic for shift left: int count = 0; for (int num : a) { if(num == 0) { newArray[count]=num; count++; } } for(int num : a) { if(num !=0) { newArray[count]=num; count++; } }
@sanketh768
@sanketh768 3 жыл бұрын
Thank you Naveen. Please continue to do these kinds of coding problems
@meghaagarwal7721
@meghaagarwal7721 3 жыл бұрын
This series is really really helpful 👍
@chetanurkudkar
@chetanurkudkar 2 жыл бұрын
Thanks a lot sir. This trick is very helpful, its very handy in many other array operations too.
@amanjotkaur774
@amanjotkaur774 3 жыл бұрын
Really appreciate your efforts sir 👍 thanks 😊
@soumyajit443
@soumyajit443 3 жыл бұрын
Hi Naveen, I was asked this question "how to Shift All Zero Element to Left Side of the Array" in my last interview. Can you please make a video of the same?
@gowthamrockz
@gowthamrockz 3 жыл бұрын
Thank you, Naveen.
@gopichinthagumpula6481
@gopichinthagumpula6481 3 жыл бұрын
Brother keep Doing... It's really helping
@anjaliupadhayay9076
@anjaliupadhayay9076 3 жыл бұрын
Thank you so much sir
@storyteller_x
@storyteller_x 3 жыл бұрын
Hey naveen, Can you do a program regarding setting the custom date and time and getting the date & Time. Take a custom class and set the date and get the salary details according to the year of joining. #interviewquestion
@sagarshrivastava2325
@sagarshrivastava2325 3 жыл бұрын
Hi Naveen...which tool/device/pad you are using to explain using pen (seems very smooth)...can you please share the details ?
@prakashbtw678
@prakashbtw678 3 жыл бұрын
Thank you
@soumyajit443
@soumyajit443 Жыл бұрын
Please share the program for keeping all zeros to the left hand side of the array . This is being asked in interviews
@prakashbtw678
@prakashbtw678 3 жыл бұрын
Please suggest any material to learn solve problems in leet code, hackerrank...
@rohitsoni2598
@rohitsoni2598 3 жыл бұрын
Sir 1 hi dil h kitni baar jeetoge.
@vidyabathija9112
@vidyabathija9112 3 жыл бұрын
Thank You.
@shankumondal2881
@shankumondal2881 3 жыл бұрын
Naveen , what FONT do you use in eclipse ?
@kishorekumar3620
@kishorekumar3620 3 жыл бұрын
Hii Naveen ,can you please tell the logic for shift left without out using two new arrays
@subramanianr2744
@subramanianr2744 3 жыл бұрын
int count = 0; for (int num : a) { if(num == 0) { newArray[count]=num; count++; } } for(int num : a) { if(num !=0) { newArray[count]=num; count++; } }
@rohitsoni2598
@rohitsoni2598 3 жыл бұрын
@@subramanianr2744 one correction subu subramani 3 hours ago int count = 0; for (int num : a) { if(num == 0) { newArray[count]=num; count++; } } you don't need to write newAray[count]=num; bcoz newArray by default is taking 0. Hope it help u
@appansingharoy491
@appansingharoy491 3 жыл бұрын
Java is fun❤️
@healthbeautytips6438
@healthbeautytips6438 3 жыл бұрын
What will be the time complexity of this programme as we are creating a new array here. Can we achieve it by single array only.
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
It will be O(n) only but with extra space. As I am not manipulating the existing array.
@healthbeautytips6438
@healthbeautytips6438 3 жыл бұрын
@@naveenautomationlabs thanks Naveen
@pandudamera7211
@pandudamera7211 3 жыл бұрын
Thank you brother
Why String is popular HashMap key in Java?
16:53
Naveen AutomationLabs
Рет қаралды 15 М.
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 12 МЛН
Стойкость Фёдора поразила всех!
00:58
МИНУС БАЛЛ
Рет қаралды 6 МЛН
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 658 М.
Find Duplicate Elements in An Array || Important Java Interview Questions
22:36
Naveen AutomationLabs
Рет қаралды 52 М.
How to move Zeroes to end of an Array? | Animation
14:45
Dinesh Varyani
Рет қаралды 39 М.
Why password should be stored in char array char[] instead of string?
9:19
Naveen AutomationLabs
Рет қаралды 51 М.
Shift All 1's to left side in an array java program
18:25
Automation Hub Software Testing
Рет қаралды 596
Tricky Interview Question: Maximum Number of Method Parameters Allowed in #Java
13:31
Get the Count of Words From a Capitalized String - Java Interview Question
13:46
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 12 МЛН