This channel is run by Yogesh and Shailesh (Twin Brothers). Here we provide the following contents:
1) Solution editorial of top handpicked DSA problems that were asked in Interviews of Big IT Companies. 2) Guidance Video 3) Off Campus Drive 4) Podcasts 5) CTC Breakdown 6) Vlogs
Fake as hell , the company every year in OA ask the same 3 qsn present on leetcode , the OA platform is dog shit , where if you will include bits/stdc++ no test cases will run , it will show empty , but if you include each header by its file then it will include , worst ever , their ctc breakup would also be scam 🤮🤮🤮🤢🤢
To everybody who is struggling #include<iostream> #include<vector> #include<algorithm> using namespace std; long long availableWood(vector<int> &arr , int n , int mid) { long long woodCount = 0; for (int i = 0 ; i<n ; i++) { if (arr[i] > mid) { woodCount += arr[i] - mid; } } return woodCount; } int maxHeight(vector<int> &arr , int n , int m) { int start = 0; int ans = 0; int end = *max_element(arr.begin(),arr.end()); while(start<=end) { int mid = start+(end-start)/2; if (availableWood(arr,n,mid) >= m) { ans = mid; start = mid + 1; } else { end = mid - 1; } } return ans; } int main() { int n,m; cin>>n>>m; vector<int> arr(n); for (int i = 0 ; i<n ; i++) { cin>>arr[i]; } cout<<maxHeight(arr,n,m); } This solution which I have written is 100 percent correct Your possible mistakes :: 1) use long long instead of int 2). use vector instead of array
the code provided in video is wrong. below is correct code. class Solution { boolean isSumTree(Node root) { boolean[] ans=new boolean[1]; ans[0]=true; int res=recurse(root,ans); return ans[0]; } static int recurse(Node root,boolean[] ans) { if (root==null) return 0; int left=recurse(root.left,ans); int right=recurse(root.right,ans); int sum=left+right; if (sum!=root.data && sum!=0) ans[0]=false; root.data+=sum; //System.out.println(root.data); return root.data; } }