Frequency of the Most Frequent Element | LeetCode | Binary search | Sliding window | Prefix sum |DSA

  Рет қаралды 17,028

Aditya Rajiv

Aditya Rajiv

Күн бұрын

Пікірлер: 27
@LeelaLakshmiKundi
@LeelaLakshmiKundi Жыл бұрын
Great way of explaining ......Keep doing🙏🙏Thank you so much
@sauravchandra10
@sauravchandra10 Жыл бұрын
I was missing the sliding window part, thanks for explaining it so clearly!
@vcs649
@vcs649 11 ай бұрын
Excellent work
@Ajay-k5i
@Ajay-k5i Жыл бұрын
Nice explanation with great approach
@anug14
@anug14 2 жыл бұрын
thanks using prefix sum directly is more readable for me: public int maxFrequency(int[] nums, int k) { Arrays.sort(nums); int n = nums.length; // prepare prefix sum int[] pre = new int[n]; pre[0] = nums[0]; for(int i = 1; i < n; i++){ pre[i] += pre[i - 1] + nums[i]; } // start binary search int ans = 1; int l = 1; int r = n; while(l
@sumanthvarma1908
@sumanthvarma1908 Жыл бұрын
Excellent explanation Thank you
@iamnoob7593
@iamnoob7593 Жыл бұрын
Thanks Man , I Understood , But main key part is to understand why sorting is required and why sliding window is required .
@shivamuniyal9274
@shivamuniyal9274 Жыл бұрын
agreed 🙂
@Amansharma-dr6cx
@Amansharma-dr6cx 3 жыл бұрын
Keep it up man, clean approach and solution.
@adityarajiv6346
@adityarajiv6346 3 жыл бұрын
Thanks😀. Please share the channel with all your friends and subscribe 👍
@ankitsharda1131
@ankitsharda1131 Жыл бұрын
Superb explanation man!!
@kumarabhishek9477
@kumarabhishek9477 2 жыл бұрын
Nice approach and explanation. Keep the good work going.
@aftabhaider8556
@aftabhaider8556 2 жыл бұрын
very good approach
@the_amey_parashar
@the_amey_parashar 8 ай бұрын
why did we apply binary search?
@kalyan539
@kalyan539 2 жыл бұрын
hey one doubt at 16.31 time u said 7+4=11 [1,4,8] range ..i didnt get which operations u did!
@lover_of_u3455
@lover_of_u3455 Жыл бұрын
Means (8-1)+(8-4)=7+4=11
@lover_of_u3455
@lover_of_u3455 Жыл бұрын
To make 1 and 4 equal to 8 we have to increase 1 by 7 operation and increase 4 by 4 operation. Total operations required to make all the element equal to 8 is 11
@ajitpalsingh9805
@ajitpalsingh9805 2 жыл бұрын
great approach man keep it up
@shivamaggarwal7357
@shivamaggarwal7357 Жыл бұрын
i converted your code in java and it is not working??? please write a java code
@AbhishekRaj-vr8rb
@AbhishekRaj-vr8rb 2 жыл бұрын
thanks bhaiya...
@adityarajiv6346
@adityarajiv6346 2 жыл бұрын
Welcome😀👍. Please share the channel with all your friends 👍
@ankit_yadav11
@ankit_yadav11 11 ай бұрын
bhai runtime error q aa rha h line by line match kar chuka hun ayar
@ananypandey1310
@ananypandey1310 2 жыл бұрын
what does 1LL represent ?
@adityarajiv6346
@adityarajiv6346 2 жыл бұрын
long long int
@Randomuser7890
@Randomuser7890 Жыл бұрын
why are we sorting???
@lover_of_u3455
@lover_of_u3455 Жыл бұрын
Since we can only increase the number by 1 and we need all the element that were less than target so that with the help of k operations we can make them equal to the target value value that's why we sort it
VAMPIRE DESTROYED GIRL???? 😱
00:56
INO
Рет қаралды 8 МЛН
兔子姐姐最终逃走了吗?#小丑#兔子警官#家庭
00:58
小蚂蚁和小宇宙
Рет қаралды 9 МЛН
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 328 М.
How AI 'Understands' Images (CLIP) - Computerphile
18:05
Computerphile
Рет қаралды 207 М.
BS-14. Find the Smallest Divisor Given a Threshold | Binary Search
16:00
Google Data Center 360° Tour
8:29
Google Cloud Tech
Рет қаралды 5 МЛН
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 622 М.
Find The Most Frequent Value In An Array | C Programming Example
9:44
Portfolio Courses
Рет қаралды 11 М.
BS-18. Allocate Books or Book Allocation | Hard Binary Search
27:29
take U forward
Рет қаралды 174 М.