Загрузка...

Apply Operations to Maximize Score | Super Detailed Approach For Beginners | Leetcode 2818 | MIK

iPad PDF Link : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad%20PDF%20Notes/Leetcode-2818-.pdf
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A

Sieve Of Eratosthenes Detailed - https://www.youtube.com/watch?v=61LWhWexFI4
Binary Exponentiation - https://www.youtube.com/watch?v=D320QeHS0XQ

Similar problem - Leetcode - 907
https://youtu.be/HRQB7-D2bi0?si=1_Cgi5wRaDxQB3Za

Hi Everyone, this is the 25th video of our Playlist "Maths : Popular Interview Problems".
Now we will be solving a good Maths problem - Apply Operations to Maximize Score | Super Detailed Approach For Beginners | Leetcode 2818 | codestorywithMIK

We will start from scratch and cover everything in minute details. It might be lengthy but please see it at more speed if required.

Problem Name : Apply Operations to Maximize Score | Super Detailed Approach For Beginners | Leetcode 2818 | codestorywithMIK
Company Tags : will update later
My solutions on Github(C++ & JAVA) - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Mathematical/Apply%20Operations%20to%20Maximize%20Score.cpp
Leetcode Link : https://leetcode.com/problems/apply-operations-to-maximize-score/description/
My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Segment Tree Concepts Playlist : https://www.youtube.com/watch?v=k99r1A7krcY&list=PLpIkg8OmuX-K1qUIQToCllUO0UIKXt8dB
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Zduesi8&list=PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM
Trie Playlist - https://www.youtube.com/watch?v=DMP2bqW6URA&list=PLpIkg8OmuX-I99uuP2BZOz4mI_lms4gVG
Difference Array Technique: Concepts & Qns : https://www.youtube.com/watch?v=ZHNVmtm08WY&list=PLpIkg8OmuX-Kqkb8DqDe_4-Tiav6ilS_L
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

Video Summary :
The goal is to maximize the score by strategically selecting subarrays and multiplying elements’ powers.
The approach begins by computing the prime score of each element — which is the count of distinct prime factors of that number. To do this efficiently, we use the Sieve of Eratosthenes to precompute primes and then count prime factors for each element.
Once we have the prime scores, we use the Next Greater and Previous Greater element concepts to determine how many subarrays can be formed where each element is the maximum based on its prime score. This helps in deciding the contribution of each element.
To maximize the score, we sort the elements in descending order and greedily pick the largest elements first. For each element, we compute how many times it can be included in the score based on its subarray contribution and remaining k.
To handle large powers efficiently, we use Binary Exponentiation (Fast Power Algorithm) while multiplying to avoid overflow and keep the result within modulo.
✨ Timelines✨
00:00 - Introduction
0:33 - Motivation
1:06 - Problem Explanation
5:43 - Thought Process
10:22 - Calculating Valid Subarrays Count
28:03 - Finding NextGreater and PrevGreater
55:16 - Calculating PrimeScores
1:06:24 - Coding it up

#MIK #mik #Mik
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hinditech #hindilearning #helpajobseeker #jobseekers #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #videomarketing #codestorywithmik #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik

Видео Apply Operations to Maximize Score | Super Detailed Approach For Beginners | Leetcode 2818 | MIK канала codestorywithMIK
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять