Maximum XOR Pair Using Trie
Вставка
- Опубліковано 19 лют 2018
- Get COURSES For FREE Using This Scholarship Test. Register Here Now: www.codingninjas.com/landing/... Maximum XOR Pair Using Trie by - Parikh Jain
Online course insight for Competitive Programming Course. Visit for more details: www.codingninjas.in/app/cours... - Наука та технологія
5:20 it is right shift only , not left shift .
Nicely explained...
Thank You..!!
Perfection!!
You explained it very well. Great video .Thank you
Can this method also be applied for finding maximum AND pair?
Simply Great!
awesome !!! very simple and concrete ideas
Bro the method was amazing, but do we have any other method in which we need not perform the operation for every element of the array?
Brilliant! Brilliant!
Beautiful Explanation!!
thanks :) nice explanation...
Great explanation , thanks for video :)
Amazing!
I think you are wrong at the point that in the worst case you will traverse your same path ( which you are explaining at 13th minute). Well, the point is correct but the logic isn't. In case we start from 0 so we go to 1 for finding max. xor (lets say it exists ) but now we have left the current element. Hence the logic for why we don't need to worry about curr getting null is wrong. The correct reason is that at which ever point we deviate all numbers will be 32 bit long and hence at any point there is a guaranteed that it will lead us to the leaf because no path will be of length less than 32.
Yea u r right..thanks for clarifying.. actually the statement can confuse someone..with a problem to find max zor of array with elements other than the array's elements
awesome !!
Awesome Explaination
Great video, I was not able to fully understand it with geeks and other sources
I think we cannot solve maximum pairwise AND or OR in an array Question using this trie technique?? because we cant distinguish the path is of our ith part of not..
correct me if I m wrong.
Very very good!!
Pls sir aur videos daliye, plssssss.
I think we should check only 31 bits. Hence initialisation of j must be 30 instead of 31.
Brilliant explanation
Finally, I able to understand this problem. Thank you:)
Thank you for the kind words! We hope that this video has helped you!
Stay tuned to Coding Ninjas UA-cam channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home?
If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library?
If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
wow..nice explanation
where is the approach video
Clear!
Very nice and simple explanation bro..Keep it up!
This is brilliant!
Thanks for the simple most explanation i have been confused on this question for a very long time
Really Thanks
Thank you for the kind words! We hope that this video has helped you!
Stay tuned to Coding Ninjas UA-cam channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home?
If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library?
If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
Thank you brother
This is a similar problem --> www.hackerrank.com/challenges/maximum-xor/
Clearly Understand, Thank you.
Thank you for the kind words! We hope that this video has helped you!
Stay tuned to Coding Ninjas UA-cam channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home?
If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library?
If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
Awesome video man ! I think you were correct to say right shift to find the current bit
Buy the Course and get DISCOUNT OF RS:- 1200 + 35%OFF Use this Link:- codingninjas.in/app/invite/ZVUAQ for you.
Thank you very much, brother...It really helped me to understand this topic entirely
why did we take 32 bits please explain me please
Thank you for the kind words! We hope that this video has helped you!
Stay tuned to Coding Ninjas UA-cam channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home?
If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library?
If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
Very Good explanation ..
Great video
awesome.
why did we take 32 bits please explain me please
well explained
awesome explanation
Isn't there O(n) approach?
Nice explanation .Upload some more videos on BIT MANIPULATION . keep it up
easy and clear explanation _/\_
Beautiful
awesome bhai...you rock ...i love you
Buy the Course and get DISCOUNT OF RS:- 1200 + 35%OFF Use this Link:- codingninjas.in/app/invite/ZVUAQ for you.
i love you ravi
great video sir. hope you will make video on "MAXIMUM SUBARRAY XOR"
Buy the Course and get DISCOUNT OF RS:- 1200 + 35%OFF Use this Link:- codingninjas.in/app/invite/ZVUAQ for you.
Amazing explanation! hats off to you
i have a question why on line 50 we need to do curr_xor += pow(2,j) ?
To add the value to the current XOR value...if you found XOR to be 1 at any position (bit) then you need to add 2 raised to the power of that position as 1 is multiplied with that power of 2
Mazaa aa gya bro
em cheppav bhayya 👌
What if we need to find a xor pair which is greater than some given value?
In findmax pair function, set max_xor = some given value, it will give you the same value or greater
@@prateekgupta9889 the maximum xor pair will also always be greater than the given value as long as the answer exists...so you can return the maximum xor pair itself...however, if k>pow(2,log(max(arr)))+1 then no such pair would exist
It's not O(n) solution
pow(2,j-1) nahi add hona chahiye??
Nahi...(Sanju style)
Which language are you speaking?
hindi
add subtitles coder..
j he hoga,got that
can anyone help me in calculating the space complexity to above approach
If Each TrieNode occupies a memory of K bytes, then there will be 32 nodes for each Number hence total space Occupied by each number is (32*K) which is constant say M.
Now,we have N numbers so total space would be N*M where M is almost constant so,Space complexity becomes O(N)!
10:29 but thats not o(n).
dude, the inner loop will always run for 32 times. so O(31n) = O(n)
@@saiswaroop5889 it's not 31n it's 32nlogm which gives a complexity of nlogm as m is the size of number for logm for calculating pow
This guy always explains in the best way possible.
Thanks from US :)
Brilliant explanation