3066. Minimum Operations to Exceed Threshold Value II | Greedy | Time Complexity
ฝัง
- เผยแพร่เมื่อ 7 ก.พ. 2025
- In this video, I'll talk about how to solve Leetcode 3066. Minimum Operations to Exceed Threshold Value II | Greedy | Time Complexity
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
100Days 100k Placements: • 100 Days 100K Placement
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
📱Telegram : t.me/aryan_mit...
🤖 Github: github.com/ary...
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
bhai u r awesome!!!!
Thanks for your valuable efforts!!
Can you pls tell which drawing tablet do you use for explanations ?
can we solve this problem using pbds(ordered set) ,int minOperations(vector& nums, int k)
{
pbds A;
for (int i = 0; i < nums.size(); i++)
{
A.insert({nums[i], i});
/* code */
}
int minoperations = 0;
while((A.order_of_key({k,0}))!=0)
{
auto it = A.begin();
long long value1= it->first;
A.erase(it);
if(value1>=k)
{
break;
}
auto it2 = A.begin();
long long value2=it2->first;
A.erase(it2);
long long value=min(value1,value2)*2+max(value1,value2);
A.insert({value,0});
minoperations++;
}
return minoperations; this code is giving wrong answers
Hi aryan
Bhai good morning nhi good evening ho rhi thi tb
jaab jago tab sabera bro :)