Leetcode Weekly Contest 403 | Video Solutions - A to D | by Viraj Chandra | TLE Eliminators
VloĆŸit
- Äas pĆidĂĄn 28. 07. 2024
- Here are the video solutions for problems A, B, C, D of Leetcode Weekly Contest 403. We hope this will be useful for you in up-solving this contest.
đąCheck out handpicked problems by Priyansh himself, on our CP-31 sheet: www.tle-eliminators.com/cp-sheet
Solution Codes:
Problem A : leetcode.com/problems/minimum...
Problem B : leetcode.com/problems/find-th...
Problem C : leetcode.com/problems/maximiz...
Problem D : leetcode.com/problems/find-th...
Be sure to check out TLE Eliminators.
Website: www.tle-eliminators.com/
Instagram: / tle_eliminators
Linkedin: / tle-eliminators
Twitter: / tle_eliminators
TLE Community Discord Server: / discord
Timestamps:-
0:00 Problem A
9:10 Problem B
20:10 Problem C
37:10 Problem D
Please fill the feedback form: forms.gle/UetQqvq4TiZVZtbx7
[2, -3, -7] taking subarrays [2, -3, -7] or [2, -3] and [-7] gives -2 as total cost but taking subarrays [2] and [-3, -7] gives you 6 as total cost...
Very Well Explaination Viraj Sir !!
Good explanation with how he thinks about the problem in the contest
for 2nd question, I was not able to come up with this logic during the contest, now that I see this, it seems easy, but, would request you to suggest any other ideas too, though I understand that this is the easiest possible logic
brother!!, beautiful explanation for 4th one
great explaination bhaiya đ
amazing explanation of the d question!
Great explanation of 4th ,understood competely
best mentorâ€
Virajj !! Great explanation!!â€
For Q3 how to tackle during the contest as their problem statements are such bullshit... though Excellent explanation brotherđ„
Understood
The solution for third is giving TLE in java
I was able to come up with the exact same approach for the 4th question but missed it just by some mins due to wrong coordinates , However Will memoizing the answer for a particular set of rectangles optimize the soln any further or there would be no overlapping rectangles?
I did not think about this since this seemed within the TC boundaries.
im going to see ur code.....just to copy those boxes you draw for future reference đ
Hahaha lol
Here is my approach for the 2nd question
class Solution {
public:
int findMax(const vector& indexArray) {
if (indexArray.empty()) return -1;
return *max_element(indexArray.begin(), indexArray.end());
}
int findMin(const vector& indexArray) {
if (indexArray.empty()) return -1;
return *min_element(indexArray.begin(), indexArray.end());
}
int minimumArea(vector& grid) {
int rows = grid.size();
int cols = grid[0].size();
vector oneRowIndex;
vector oneColIndex;
for(int i = 0; i < rows; i++) {
for(int j = 0; j < cols; j++) {
if(grid[i][j] == 1) {
oneRowIndex.push_back(i);
oneColIndex.push_back(j);
}
}
}
if(oneColIndex.empty()) return 0;
int minRow = findMin(oneRowIndex);
int maxRow = findMax(oneRowIndex);
int minCol = findMin(oneColIndex);
int maxCol = findMax(oneColIndex);
int height = maxRow - minRow + 1;
int width = maxCol - minCol + 1;
return height * width;
}
};
very nice solution of 3rd and 4th bro
Viraj đ«Ąđ«Ąđ«Ą
bro use darkmode.
Ok Bro. I'll take care.
No audio..đą
The audio issue at some specific timestamp or in the entire video?
Leetcode contest are so shit now
true, they should be more hard
whenever i see dp problem doing greedily!!đ„Č