C++ Code - leetcode.com/problems/maximize-the-number-of-target-nodes-after-connecting-trees-i/submissions/1467124643/ Please do share with your friends or social media, it will be super super helpful 🥺
@kshitijvarma2566Ай бұрын
loved the way of explanation..... crystal clear ....
@Glitch40417Ай бұрын
Nice explanation bro. I remember watching your videos when I didn't get the easy daily leetcode questions. Today I just heard you explaining this question and I understood what to do. Thanks for your work.
@bd1a0573Ай бұрын
Very Good Explaination. Please Make Such Video For Every weekly and Bi-Weekly Contest. GodDamn You Explained it like a Master(ofcourse you are one). you earned a new sub bro. DOUBT :- How to build that intuition. I just got afraid after seeing Tree question in todays contest.
@EtherAtlasАй бұрын
thank you
@arjunkumaryadav8102Ай бұрын
Please tell the linear time complexity approach
@Engineering.WallahАй бұрын
13:30 many cheaters used dfs
@goldenx2417Ай бұрын
Bhaiya please provide cpp solution it is humble request 🙏
@ARYANMITTALАй бұрын
Sure sir, adding in description ❤️
@gururajm1Ай бұрын
Bro Please solve Q2
@GospodinStanojeАй бұрын
class Solution { public: int getLargestOutlier(vector& nums) { const int n = nums.size(); int result = INT_MIN; int total_sum = accumulate(nums.begin(), nums.end(), 0); multiset multiset(nums.begin(), nums.end()); for (const int& outliner : nums) { if ((total_sum - outliner) & 1) // Odd continue; int target = (total_sum - outliner) / 2; multiset.erase(multiset.find(outliner)); if (multiset.find(target) != multiset.end()) result = max(result, outliner); multiset.insert(outliner); } return result; } };
@amitprajapat5697Ай бұрын
bro first solve LC 3371
@GospodinStanojeАй бұрын
Here you go: class Solution { public: int getLargestOutlier(vector& nums) { const int n = nums.size(); int result = INT_MIN; int total_sum = accumulate(nums.begin(), nums.end(), 0); multiset multiset(nums.begin(), nums.end()); for (const int& outliner : nums) { if ((total_sum - outliner) & 1) // Odd continue; int target = (total_sum - outliner) / 2; multiset.erase(multiset.find(outliner)); if (multiset.find(target) != multiset.end()) result = max(result, outliner); multiset.insert(outliner); } return result; } };