Hint: observe the following if you have 1/2 => 0.5, and 3/5 => 0.6
Try adding extra student to each of them and check what will improve things more:
1/2 => 2/3 => 0.66; 0.66-050 = 0.16
3/5 => 4/6 => 0.66; 0.66-0.60 = 0.01
so 0.16>0.01. Now you need to do it for all the numbers.
Solution:
Use the max heap, whereas the key is the gain that will happen if we add the extra student. Use this key in heap (python does not have max heap, so we will work with just negative number to emulate it).
Now for all extra student every single time you get the class where you can get the biggest gain, and add this gain -> then push it back to the heap.
In the end we just calculate the average
Try adding extra student to each of them and check what will improve things more:
1/2 => 2/3 => 0.66; 0.66-050 = 0.16
3/5 => 4/6 => 0.66; 0.66-0.60 = 0.01
so 0.16>0.01. Now you need to do it for all the numbers.
Solution:
Now for all extra student every single time you get the class where you can get the biggest gain, and add this gain -> then push it back to the heap.
In the end we just calculate the average
β€2
Daily today
not hard, if you don't overthink
https://leetcode.com/problems/find-the-number-of-ways-to-place-people-i/description/?envType=daily-question&envId=2025-09-02
#daily
not hard, if you don't overthink
https://leetcode.com/problems/find-the-number-of-ways-to-place-people-i/description/?envType=daily-question&envId=2025-09-02
#daily
Hint: the data constraints are 0 >= n >= 50, it means you definitely can allow yourself n^2 or n^3. Don't overthink much, don't think about optimization.
Solution:yeah, in official one it is the same just bruteforce it: try every possible point, (right bottom) find all the points that match the criteria (left up), for this pair: check whether there is any other point inside. If no point is inside - increment counter.
Solution:
β€4
Due to injury, cannot swim in the sea, but yesterday I realized I can in the swimming pool, cause they have convenient stairs. Now it is game changer, so daily leetcode is a bit late today.
Soon we gonna check where game of thrones was filmed, will post pictures
Soon we gonna check where game of thrones was filmed, will post pictures
π₯4
This media is not supported in your browser
VIEW IN TELEGRAM
Manager: When the feature will be ready?
Me:
Me:
1π14
Sorry, there will be just a few more posts from Dubrovnik, and then - tech stuff
π8β€3π1
Daily
Don't read if you solved yesterday's daily. It is exactly the same, except n^3 will not work here due to constraints, thus labeled as hard.
https://leetcode.com/problems/find-the-number-of-ways-to-place-people-ii/description/?envType=daily-question&envId=2025-09-03
Don't read if you solved yesterday's daily. It is exactly the same, except n^3 will not work here due to constraints, thus labeled as hard.
https://leetcode.com/problems/find-the-number-of-ways-to-place-people-ii/description/?envType=daily-question&envId=2025-09-03
Solution
Hint1:try sorting.
Hint2:the solution should be O(n^2)
Hint3:sort by x asc and then by y desc. Basically you can observe that next x is always bigger or same as previous. Now whenever previous y was higher than current y - you cannot count it as previous y for sure will be inside the rectangle.
===
Didn't come up with it on my own. Had to see the solution. In a nutshell, as per last hint, we just track change of Y between current and previous. If current is higher we count one. This way we make sure there is no point inside the rectangle
Hint1:
Hint2:
Hint3:
===
Didn't come up with it on my own. Had to see the solution.
extremely good advice would be (for job security) - go and start working on some OOOOOLLLD legacy, that brings money, and literally not replaceable. You will never be replaced. You can only be laid off, or dropped in case project got replacement and stopped bringing money
β€8
andreyka26_se
extremely good advice would be (for job security) - go and start working on some OOOOOLLLD legacy, that brings money, and literally not replaceable. You will never be replaced. You can only be laid off, or dropped in case project got replacement and stoppedβ¦
Or, spend time on grinding your interview skill (leetcode, system design, intw questions), to feel extra confident and know that even in case of drop, in 1 month, you will find something else.
β€8
Daily
Today leetcode is a joke. Literally problem for 40 seconds. Go and collect the coin.
https://leetcode.com/problems/find-closest-person/description/?envType=daily-question&envId=2025-09-04
Today leetcode is a joke. Literally problem for 40 seconds. Go and collect the coin.
https://leetcode.com/problems/find-closest-person/description/?envType=daily-question&envId=2025-09-04
Daily
Mathπ. Was not able to solve on my own.
https://leetcode.com/problems/minimum-operations-to-make-the-integer-zero/description/?envType=daily-question&envId=2025-09-05
Mathπ. Was not able to solve on my own.
https://leetcode.com/problems/minimum-operations-to-make-the-integer-zero/description/?envType=daily-question&envId=2025-09-05
π1π₯1