Utopian Tree HackerRank Solution | Hackerrank Utopian Tree | [One Liner Solution]

  Рет қаралды 35,609

JAVAAID - Coding Interview Preparation

JAVAAID - Coding Interview Preparation

Күн бұрын

Пікірлер: 52
@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 ..!! 🙏🙏🙏
@mohanbhati9595
@mohanbhati9595 4 жыл бұрын
make correction in Problem statement it's different.
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
thanks we have updated the problem statement link :)
@sovnaishwarya
@sovnaishwarya 2 жыл бұрын
You are making it more complex
@rishiraj2548
@rishiraj2548 7 ай бұрын
15:00 excellent! thanks
@codedecks
@codedecks 4 жыл бұрын
Congratulations on 15k Subscribers 👍 Welcome back !!!
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Thank you..😀 I also noticed after watching your comment
@memesmacha61
@memesmacha61 4 жыл бұрын
After a long time bro...we want many more videos from you!
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Even we want to produce more content but situations are not in our favor that much.
@tusharhatwar4581
@tusharhatwar4581 4 жыл бұрын
Thank You for coming Back 🙏🙏
@shivanigoswami2773
@shivanigoswami2773 4 жыл бұрын
Hey hey hey thank you so much for come back again😍😍😍😍😍😍
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Thanks to JAVAAID family to give so much of love ❤️❤️
@kvr9423
@kvr9423 4 жыл бұрын
Great Contribution..Kudos
@anil2009
@anil2009 4 жыл бұрын
Guruji you are great. Where are you all these days
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
We are always with our JAVAAID FAMILY.❤️
@anil2009
@anil2009 4 жыл бұрын
I m trying hard to get into Zoho company guruji but I'm faling to find out good algorithm to slove the problem
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
have some passions and work hard you will see the results.
@sebajean-baptiste6240
@sebajean-baptiste6240 9 ай бұрын
I know this is old. But I struggled to understand this solution. Elegant, but a bit complicated. I did it a different way that might be easier to understand. At least for me. public static void main(String[] args) { for (int period = 0; period < 9; period++ ) { int c = cycle(period); int result = period % 2 == 0 ? calculate(c) : calculate(c) - 1; System.out.println( period + " : " + result); } } public static int cycle(int period) { if( period % 2 == 0) return period / 2; return (period + 1) / 2; } public static int calculate(int cycle) { return Double.valueOf(Math.pow(2, cycle + 1)).intValue() - 1; }
@aravinddesikamani
@aravinddesikamani 4 жыл бұрын
Welcome back😁
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Thank you 😊
@karimdinani9845
@karimdinani9845 18 күн бұрын
if(n%2==0) height = pow(2,(n/2) +1) -1 ; else height = pow(2,((n+1)/2) +1) -2 ;
@JohnWindberg
@JohnWindberg 4 ай бұрын
There's probably a one liner, without bitwise math, but I'm having trouble figuring it out. Something like 2^(n-1) + n%2
@JohnWindberg
@JohnWindberg 4 ай бұрын
I find bitwise math to be unreadable.
@RahulKumar-ud3ct
@RahulKumar-ud3ct 4 жыл бұрын
Sir , can't we apply a simple for loop with if (i%2==0){ Count =count +1;} And else { count =count *2 ;}
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
You can but bitwise operations are much faster than anything else. so for large input your program will be a little bit slow.
@VinayKumar-tv5bc
@VinayKumar-tv5bc 4 жыл бұрын
@@JavaAidTutorials please elaborate this code as send by @rahul kumar
@shannu9572
@shannu9572 4 жыл бұрын
happy teachers day javaaid maya
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Thank you..😊 but who is maya🤔
@maqsamqureshi1052
@maqsamqureshi1052 2 жыл бұрын
Sir it is simple programming question or data structure question
@rishiraj2548
@rishiraj2548 2 жыл бұрын
Wow! Many thanks
@optimusprime692
@optimusprime692 4 жыл бұрын
Super solution!
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Glad you think so!
@mahmmadhusen6794
@mahmmadhusen6794 4 жыл бұрын
Please upload more videos
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Sure, we will try our best.
@indlasubramanyam9510
@indlasubramanyam9510 3 жыл бұрын
Audio is not up to the mark
@jaidheersirigineedi8110
@jaidheersirigineedi8110 4 жыл бұрын
Thank you sir!!
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
Most welcome!
@navinchainani4721
@navinchainani4721 4 жыл бұрын
Sir plz explain also using if else
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
That approach is not optimal, but still you want, we have some old code, will paste it here for reference. Or for short use this algo- If cycle is even multiple height by 2 Else increase the height by 1
@navinchainani4721
@navinchainani4721 4 жыл бұрын
@@JavaAidTutorials thanks
@fernandogaldino5309
@fernandogaldino5309 3 жыл бұрын
Using if/else, try this... It works for me... public static int utopianTree(int n) { // Write your code here int height = 0; for(int i = 0; i
@salilkumarghosh9861
@salilkumarghosh9861 4 жыл бұрын
Sir can I solve these problems using C after watching all videos?
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
We always try to teach generic algorithm which is independent of any specific language. so you can use any language to implement the same
@RahdixCloudNine
@RahdixCloudNine 2 жыл бұрын
WTF ??? subscribed!
@saikande8085
@saikande8085 4 жыл бұрын
Can you explain again sir
@JavaAidTutorials
@JavaAidTutorials 4 жыл бұрын
The good thing about video tutorial is , if you have any doubt you can replay it. We are ready to explain again, just watch this video one more time. I hope things will be more clear next time.:)
@manojb1606
@manojb1606 3 жыл бұрын
Voice very un easy to hear
@abhisekpanda3701
@abhisekpanda3701 2 жыл бұрын
public class utopianTree { public static void main(String[] args) { int n=utopian(5); //utopian(7); System.out.println(n); } static int utopian(int n) { int value=1; for(int i=0;i
Repeated String HackerRank Solution [Optimal Approach]
16:41
JAVAAID - Coding Interview Preparation
Рет қаралды 197 М.
Jumping On The Clouds HackerRank Solution [One Liner Solution]
26:26
JAVAAID - Coding Interview Preparation
Рет қаралды 53 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
Ozoda - Alamlar (Official Video 2023)
6:22
Ozoda Official
Рет қаралды 10 МЛН
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.
5 Problem Solving Tips for Cracking Coding Interview Questions
19:12
Utopian tree
28:43
TAP ACADEMY
Рет қаралды 2,3 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
What if you just keep zooming in?
21:29
Veritasium
Рет қаралды 4,2 МЛН
Clean Code - Uncle Bob / Lesson 1
1:48:42
UnityCoin
Рет қаралды 2 МЛН
Amateurs Just Solved a 30-Year-Old Math Problem
20:19
Up and Atom
Рет қаралды 54 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 693 М.
How do computers read code?
12:01
Frame of Essence
Рет қаралды 3,2 МЛН
Count Triplets Hackerrank Solution | Interview Preparation Kit
29:59
JAVAAID - Coding Interview Preparation
Рет қаралды 37 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН