Тёмный

Jumping On The Clouds HackerRank Solution [One Liner Solution] 

JAVAAID - Coding Interview Preparation
Подписаться 38 тыс.
Просмотров 53 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 102   
@JavaAidTutorials
@JavaAidTutorials 4 года назад
If you find this tutorial helpful, please do not forget to like , comment, share and It would be great if you can leave your feedback about the tutorial, as I have put a lot of hard work to make things easy for you. Thanks ..!! 🙏🙏🙏
@thetraveller7777
@thetraveller7777 4 года назад
Sir, if my mobile is hacked I will what to do?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
We do not provide any content related to hacking.
@albatrossmullick8929
@albatrossmullick8929 3 года назад
What if there is 2 or more than 2 consecutive thunder cloud(1) is present between the array?? what will be your output??
@albatrossmullick8929
@albatrossmullick8929 3 года назад
I think your solution won't terminate in this exception because your loop always has 1 increment with count of 1 for sure
@NicolayGiraldo
@NicolayGiraldo 3 года назад
@@albatrossmullick8929 The premise of the problem says the game can always be won. So my interpretation is that there are no two consecutive number 1s in the array.
@BlitzkriegBlue
@BlitzkriegBlue 4 года назад
Man, I can't thank you enough. I couldn't understand the problem right through the website description but once I heard you explain I got it. Your explanations are great, simple to understand and helpful to improve my skills. Keep going with those tutorials, they are of great help!
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thanks for the feedback 🙂 If you find it helpful, please do share with others
@aernidius
@aernidius 3 года назад
Thanks for guiding us through this exercise and breaking down the steps! ^^ And yes, I do indeed want to be a cool dude in front of my friends.
@vijayjangid8967
@vijayjangid8967 4 года назад
Kanhaiya you are doing really good work, it shows you are selfless and you care about us. This is how our country is gonna develop. Keep uploading such videos.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thank you for such a nice feedback 😊
@isharacooray7193
@isharacooray7193 8 месяцев назад
Thanks for the tutorial.. We also can write a more concise code using java 8 string s = abc; int n=10; while(s.length() (char)c).filter(ch -> ch.equals('a')).count();
@movieworld9471
@movieworld9471 4 года назад
Hello sir, instead of doing count = -1 We can use the condition on for loop that is i< array.length-1 So that time take to execute one time for loop will be saved.
@movieworld9471
@movieworld9471 4 года назад
If I am doing somewhere mistake, please let me know.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Did you watch this video completely without skipping or forwarding?? Because i have explained this in this tutorial.
@SukhpreetSingh-bd3wo
@SukhpreetSingh-bd3wo 4 года назад
That is what I did, too. i < len - 1
@mayanksrivastava4452
@mayanksrivastava4452 4 года назад
16:40
@started9209
@started9209 4 года назад
@@JavaAidTutorials i watched the whole vid. it comes out right too, but is it wrong or can we do it like that too.
@jorges9552
@jorges9552 4 года назад
OMG I love you man, lol! I was complicating myself a lot and never thought of this solution. Thank you so much
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Glad I could help!
@tallurivamsi6413
@tallurivamsi6413 6 месяцев назад
Great explanation Sir.really commendable.....Thank you for your effort and making us learning....
@codewithhanoak
@codewithhanoak 4 года назад
Wow, you do a very good job in cracking all of those HackerRank questions. Very impressed. Thank you.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
most welcome :)
@TysonEmmy
@TysonEmmy 4 года назад
Where you gone , Please come back and explain us more Hackerrank question :'( .You're the only RU-vidr who does it.Please Come Back.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Coming soon..😊
@shikshajain8714
@shikshajain8714 3 года назад
i easily understand this logic..thanks for helping..
@JavaAidTutorials
@JavaAidTutorials 3 года назад
thank you 😊
@prakashkumar1152
@prakashkumar1152 4 года назад
Dear sir you are doing great job the students like me.Please sir complete the hackerrank playlist.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Sure I will
@lasithadulshan7357
@lasithadulshan7357 3 года назад
Wow 🤩 .. Exellent teaching .. Thank you very much
@JavaAidTutorials
@JavaAidTutorials 3 года назад
So nice of you
@sandeepraulo4238
@sandeepraulo4238 3 года назад
I was able to write the code on my own but i was getting array out of bound, but after getting proper explanation i was able to solve my issue no need to wait for coding part in video
@ivankristoffer7764
@ivankristoffer7764 4 года назад
Amazing. Im a fan now!
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thank you 😊
@manojkumarparuchuri5920
@manojkumarparuchuri5920 3 месяца назад
brilliant solution thank you so much
@sakthivendhan7534
@sakthivendhan7534 2 года назад
hi what if the array has continuous '1's, i+1 and i+2 both are '1' in this case would you jump and count the jump or skip ? [0,1,0,0,0,1,0,0,1,1,1,1] - what is the output (if you avoid 1's in the last short distance would be 4, if you count on 1's it would be 8
@aero-036srivatsanp9
@aero-036srivatsanp9 2 года назад
i have found a solution but idk wether its optimistic or not public static void main(String[] args) { int arr[] = {0,0,1,0,1,0,1,0,0,0,1,0}; //6 int step =0; int i =0; while(i
@mayanksrivastava4452
@mayanksrivastava4452 4 года назад
thanks a lot for such a great explanation, and for such helpful solution videos.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Glad it was helpful!
@shree1365
@shree1365 4 года назад
Thanku sir your teaching style very easy and understandable thnks sir😍❤️ love for ur teaching
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thanks and welcome
@coffeemaker693
@coffeemaker693 3 года назад
We can also use continue keyword in JAVA, For example i use this in C# Here my solution private static int JumpinClouds(int[] n) { int numOfJump = 0; for (int i = 0; i < n.Length; i++) { int newIndex = i + 1; if (newIndex < n.Length) { if (n[newIndex] == 0) { i++; numOfJump++; continue; } } numOfJump++; } return numOfJump; }
@padmajavepakomma8648
@padmajavepakomma8648 4 года назад
Your excellent brother plz do vedios on interview bit questions also brother 👌👌👌👌 explanation
@JavaAidTutorials
@JavaAidTutorials 4 года назад
We will try.
@eggikh
@eggikh 4 года назад
Myfriend ) thank you! yoa are awesome! if you have any extra time , pleas do video about "cavity map" problem , and "Matrix Layer Rotation" ))
@JavaAidTutorials
@JavaAidTutorials 4 года назад
will review this problem if its good problem will definitely upload tutorial on that.
@eggikh
@eggikh 4 года назад
@@JavaAidTutorials thank for your reply, bro!)
@vikask8970
@vikask8970 4 года назад
Gr8 explanations...one questions...which editor/tool you have used for the text and drawings?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
i use microsoft onenote.
@gagansuneja7029
@gagansuneja7029 4 года назад
Hi sir you are doing very great job for us, do you have playlist in which we have topic wise solutions. Like we start with greedy and its problems,game theory and problems, recursion and problems like this.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
thanks for the feedback @Gagan but currently we do not have playlist for all categories. we have some useful playlist which i would request you to check based on your need. here is the link- ru-vid.com_all_playlists?nv=1 Once we add more solutions based on that we will update our playlist as well.
@gagansuneja7029
@gagansuneja7029 4 года назад
@@JavaAidTutorials this url is broke
@VishalKumar-sm8bo
@VishalKumar-sm8bo 4 года назад
Thanks a lot for this explanation..💯💯
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Glad it was helpful!
@bhartimandlik4838
@bhartimandlik4838 3 месяца назад
Thank you sir 😊
@navinchainani4721
@navinchainani4721 4 года назад
Bro plz make a video on repeated string
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Sure, just wait for some time, will upload the solution for this soon..
@madhangig8173
@madhangig8173 4 года назад
Can you please solve fradulent activity notification and Sherlock and the valid string?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Will upload the solution for more problems once the lockdown overs.
@akashpratapsingh3553
@akashpratapsingh3553 4 года назад
Please make a video on "Between Two Sets" hackerrank problem
@JavaAidTutorials
@JavaAidTutorials 4 года назад
will try to upload for this but need some time. till then stay tuned.
@adithyets4631
@adithyets4631 3 года назад
problem in my python code def jumpingOnClouds(c): count = -1 for i in range(len(c)-2): if i+2 < n and c[i+2]==0: i += 2 print() else: i+=1 count+=1 return count if __name__ == '__main__': n = int(input()) c = list(map(int, input().rstrip().split())) result = jumpingOnClouds(c) print(result) test case 0 and 1 only passed rest all failed
@harshithamh7930
@harshithamh7930 4 года назад
Tqsm sir
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Welcome
@mrrishiraj88
@mrrishiraj88 2 года назад
Thanks
@mdabidiqbal1153
@mdabidiqbal1153 4 года назад
great explanation
@JavaAidTutorials
@JavaAidTutorials 4 года назад
thank you. 🙂
@deepeshreddy4700
@deepeshreddy4700 4 года назад
can u plz explain why did he take i+2 in the if condition??
@agraharisunil2
@agraharisunil2 4 года назад
Nice Explanation :)
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thanks 🙂
@gowrisankar2177
@gowrisankar2177 Год назад
How can I solve any problem
@navinchainani4721
@navinchainani4721 4 года назад
When u are making upcoming videos
@JavaAidTutorials
@JavaAidTutorials 4 года назад
got stuck due to LOCKDOWN without my personal laptop :(. So no uploads from 2 months.
@rudranarayandash1466
@rudranarayandash1466 4 года назад
if there is a complex program. can I use the inbuilt function as an online test (java)?like Arrays.sort......?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Hackerrank does not stop you to use any inbuilt function. You can use it in online test as well.
@adisuryatejakadiyala8136
@adisuryatejakadiyala8136 4 года назад
Program starts @13:00
@Rahul-uk4su
@Rahul-uk4su 4 года назад
Please solve the angry children 2 problem..
@shivanshbajpai4144
@shivanshbajpai4144 4 года назад
Can you make video on manacher's algorithm
@JavaAidTutorials
@JavaAidTutorials 4 года назад
will try our best but due to lockdown not able to upload any content.:(
@shivanigoswami2773
@shivanigoswami2773 4 года назад
Is it cover all the questions from hacker rank???
@JavaAidTutorials
@JavaAidTutorials 4 года назад
not all but most of the questions are covered in my hackerrank playlist, we will continue to add more
@shivanigoswami2773
@shivanigoswami2773 4 года назад
@@JavaAidTutorials thanks it is one the best play list on RU-vid..which provide hackker solution.i really appreciate your hard work...m request you pls cover maximum solution of hackker and hackker earth
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thanks for the feedback 😊 We are working on it. If you find our channel helpful, please support us by sharing it with your friends.
@abhimanyujena191
@abhimanyujena191 4 года назад
can you solve the poisonous plant problem
@JavaAidTutorials
@JavaAidTutorials 4 года назад
I can solve that problem but need some time to make a tutorial on this.
@Matee2334
@Matee2334 3 года назад
dude, this throws me error after the first two test cases.
@MallikarjunGuggari-wc9ml
@MallikarjunGuggari-wc9ml 9 месяцев назад
me also 3 test case error
@hilalsemercioglu8599
@hilalsemercioglu8599 Год назад
my solution: ´´´function jumpingOnClouds(c) { // Write your code here let jump=0 let length =c.length c.reduce((prev,curr,index) => {let r= prev +1 ; if (r===2 ){ jump+=1 ;curr===1 ? r= 1 : r=0 } else if( r===1 && index===length-1){jump+=1} return r }) return jump }´´´
@vaishnavireddy490
@vaishnavireddy490 4 года назад
Sir I dint get y exactly is count=-1
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Did you watch this video completely without skipping or forwarding?? Because i have explained this in this tutorial.
@mayanksrivastava4452
@mayanksrivastava4452 4 года назад
16:40
@shobhagade8891
@shobhagade8891 3 года назад
Tell me output for this input [0 0 0 0 1 1 1 0]
@harishks.kumar.7886
@harishks.kumar.7886 10 месяцев назад
the count will increase in this case.
@rahimkorbo8158
@rahimkorbo8158 3 года назад
Nic3
@navinchainani4721
@navinchainani4721 4 года назад
I not understand why u put count -1
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Did you watch this video completely without skipping or forwarding?? Because i have explained this in this tutorial.
@mayanksrivastava4452
@mayanksrivastava4452 4 года назад
16:40
@sateeshkumar1476
@sateeshkumar1476 3 года назад
we can do one thing ki for loop i to array.length-1 tak chala lo , tab count ki value -1 ke jagah 0 intialise kar sakte ho, sir m i ryt?
Далее
Viral advertising
22:43
Просмотров 857
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
Купил КЛОУНА на DEEP WEB !
35:51
Просмотров 2,7 млн
New Year Chaos HackerRank Solution
23:56
Просмотров 52 тыс.
How I Got Good at Coding Interviews
6:29
Просмотров 1,7 млн
The TRIPLE FOLDING phone has a Problem.
12:54
Просмотров 1,9 млн
Bigger Is Greater HackerRank Solution
11:50
Просмотров 15 тыс.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
How To Solve HackerRank Drawing Book Problem
11:00
Просмотров 17 тыс.
My top 5 most popular front-end tips
22:07
Просмотров 38 тыс.
Separate the Numbers HackerRank Solution
19:25
Просмотров 26 тыс.
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47