Jumping On The Clouds HackerRank Solution [One Liner Solution]

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ม.ค. 2025

ความคิดเห็น • 102

  • @JavaAidTutorials
    @JavaAidTutorials  5 ปีที่แล้ว +6

    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 5 ปีที่แล้ว +2

      Sir, if my mobile is hacked I will what to do?

    • @JavaAidTutorials
      @JavaAidTutorials  5 ปีที่แล้ว +1

      We do not provide any content related to hacking.

    • @albatrossmullick8929
      @albatrossmullick8929 3 ปีที่แล้ว +1

      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 ปีที่แล้ว +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 ปีที่แล้ว +6

    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 ปีที่แล้ว +4

    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 ปีที่แล้ว +2

    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.

  • @jorges9552
    @jorges9552 4 ปีที่แล้ว +2

    OMG I love you man, lol! I was complicating myself a lot and never thought of this solution. Thank you so much

  • @tallurivamsi6413
    @tallurivamsi6413 9 หลายเดือนก่อน

    Great explanation Sir.really commendable.....Thank you for your effort and making us learning....

  • @isharacooray7193
    @isharacooray7193 11 หลายเดือนก่อน

    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();

  • @lasithadulshan7357
    @lasithadulshan7357 4 ปีที่แล้ว +1

    Wow 🤩 .. Exellent teaching .. Thank you very much

  • @ivankristoffer7764
    @ivankristoffer7764 4 ปีที่แล้ว +2

    Amazing. Im a fan now!

  • @codewithhanoak
    @codewithhanoak 4 ปีที่แล้ว +1

    Wow, you do a very good job in cracking all of those HackerRank questions. Very impressed. Thank you.

  • @shikshajain8714
    @shikshajain8714 4 ปีที่แล้ว +1

    i easily understand this logic..thanks for helping..

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

  • @shree1365
    @shree1365 4 ปีที่แล้ว +1

    Thanku sir your teaching style very easy and understandable thnks sir😍❤️ love for ur teaching

  • @sakthivendhan7534
    @sakthivendhan7534 2 ปีที่แล้ว +1

    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

  • @movieworld9471
    @movieworld9471 4 ปีที่แล้ว +3

    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.

  • @prakashkumar1152
    @prakashkumar1152 4 ปีที่แล้ว +2

    Dear sir you are doing great job the students like me.Please sir complete the hackerrank playlist.

  • @manojkumarparuchuri5920
    @manojkumarparuchuri5920 5 หลายเดือนก่อน

    brilliant solution thank you so much

  • @TysonEmmy
    @TysonEmmy 4 ปีที่แล้ว +1

    Where you gone , Please come back and explain us more Hackerrank question :'( .You're the only TH-camr who does it.Please Come Back.

  • @VishalKumar-sm8bo
    @VishalKumar-sm8bo 4 ปีที่แล้ว +1

    Thanks a lot for this explanation..💯💯

  • @mayanksrivastava4452
    @mayanksrivastava4452 4 ปีที่แล้ว +1

    thanks a lot for such a great explanation, and for such helpful solution videos.

  • @padmajavepakomma8648
    @padmajavepakomma8648 4 ปีที่แล้ว +1

    Your excellent brother plz do vedios on interview bit questions also brother 👌👌👌👌 explanation

  • @bhartimandlik4838
    @bhartimandlik4838 6 หลายเดือนก่อน

    Thank you sir 😊

  • @agraharisunil2
    @agraharisunil2 4 ปีที่แล้ว

    Nice Explanation :)

  • @gagansuneja7029
    @gagansuneja7029 4 ปีที่แล้ว +1

    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-
      th-cam.com/users/view_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

  • @ramzes_977
    @ramzes_977 4 ปีที่แล้ว +1

    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.

    • @ramzes_977
      @ramzes_977 4 ปีที่แล้ว

      @@JavaAidTutorials thank for your reply, bro!)

  • @vikask8970
    @vikask8970 4 ปีที่แล้ว +1

    Gr8 explanations...one questions...which editor/tool you have used for the text and drawings?

  • @navinchainani4721
    @navinchainani4721 5 ปีที่แล้ว +3

    Bro plz make a video on repeated string

    • @JavaAidTutorials
      @JavaAidTutorials  5 ปีที่แล้ว +2

      Sure, just wait for some time, will upload the solution for this soon..

  • @mdabidiqbal1153
    @mdabidiqbal1153 5 ปีที่แล้ว +1

    great explanation

  • @madhangig8173
    @madhangig8173 4 ปีที่แล้ว +1

    Can you please solve fradulent activity notification and Sherlock and the valid string?

    • @JavaAidTutorials
      @JavaAidTutorials  4 ปีที่แล้ว +1

      Will upload the solution for more problems once the lockdown overs.

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

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

  • @aero-036srivatsanp9
    @aero-036srivatsanp9 2 ปีที่แล้ว +1

    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

  • @akashpratapsingh3553
    @akashpratapsingh3553 4 ปีที่แล้ว +1

    Please make a video on "Between Two Sets" hackerrank problem

    • @JavaAidTutorials
      @JavaAidTutorials  4 ปีที่แล้ว +1

      will try to upload for this but need some time.
      till then stay tuned.

  • @mrrishiraj88
    @mrrishiraj88 3 ปีที่แล้ว

    Thanks

  • @harshithamh7930
    @harshithamh7930 4 ปีที่แล้ว +1

    Tqsm sir

  • @adithyets4631
    @adithyets4631 4 ปีที่แล้ว

    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

  • @navinchainani4721
    @navinchainani4721 4 ปีที่แล้ว +2

    When u are making upcoming videos

    • @JavaAidTutorials
      @JavaAidTutorials  4 ปีที่แล้ว

      got stuck due to LOCKDOWN without my personal laptop :(.
      So no uploads from 2 months.

  • @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.:(

  • @adisuryatejakadiyala8136
    @adisuryatejakadiyala8136 4 ปีที่แล้ว

    Program starts @13:00

  • @Rahul-uk4su
    @Rahul-uk4su 4 ปีที่แล้ว

    Please solve the angry children 2 problem..

  • @shivanigoswami2773
    @shivanigoswami2773 4 ปีที่แล้ว

    Is it cover all the questions from hacker rank???

    • @JavaAidTutorials
      @JavaAidTutorials  4 ปีที่แล้ว +1

      not all but most of the questions are covered in my hackerrank playlist, we will continue to add more

    • @shivanigoswami2773
      @shivanigoswami2773 4 ปีที่แล้ว +1

      @@JavaAidTutorials thanks it is one the best play list on TH-cam..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 ปีที่แล้ว +1

      Thanks for the feedback 😊
      We are working on it. If you find our channel helpful, please support us by sharing it with your friends.

  • @gowrisankar2177
    @gowrisankar2177 ปีที่แล้ว

    How can I solve any problem

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

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

  • @Matee2334
    @Matee2334 3 ปีที่แล้ว

    dude, this throws me error after the first two test cases.

  • @hilalsemercioglu8599
    @hilalsemercioglu8599 2 ปีที่แล้ว

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

  • @shobhagade8891
    @shobhagade8891 3 ปีที่แล้ว +1

    Tell me output for this input [0 0 0 0 1 1 1 0]

  • @rahimkorbo8158
    @rahimkorbo8158 3 ปีที่แล้ว

    Nic3

  • @navinchainani4721
    @navinchainani4721 5 ปีที่แล้ว

    I not understand why u put count -1

    • @JavaAidTutorials
      @JavaAidTutorials  5 ปีที่แล้ว

      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?