Thank you for the explanation, Simple, Best and No Story telling like others..... Straight to the point and saved good amount of time...... No doubts, Had to subscribe.....
Once again excellent explanation .thank you so much mam ❤❤ Honestly, whenever I want to find the solution to any question, I look for your video first :) And Thank you again for accepting the connection request on Linked In.
I think for N/3 question the coding is wrong. both candidate 1 & candidate 2 will be same by that code u r simply applying same conditions for two variables....how can outcome will be diff?
Read the question carefully on leetcode. "The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array." The majority element always exist !
@pradhan - For n/2 case, The question says "You may assume that the majority element always exists in the array", the example case (A={3,4,3,4,1,1}) you have taken for this question itself is wrong. The question says that you just have to find the majority element in the array and it will always exist in the array. While on the other hand, for n/3 case, it is never mentioned that "you can assume at least one n/3 element will exist", that's why we are counting and to know if 0 or 1 or 2 elements exists having more than n/3 count.
Di, can you make a video on how to build logic, solution seems easy by watching your videos, but getting it done by myself is tough. How to build logic like you?