2026 May 16 Problems

32 views
Skip to first unread message

daryl...@gmail.com

unread,
May 16, 2026, 12:46:57 PMMay 16
to leetcode-meetup
Feel free to work on any of the problems you want; we'll have people present their solutions at 11:30.

Please post your solutions to this thread so others can use this as a reference.

3638. Maximum Balanced Shipments Medium 61.4%


Hard problem is carried over

2742. Painting the Walls Hard 49.0%

We will have a different Zoom meeting that Bhupathi is providing this week:

Here is the meeting url:

Full details:

Topic: Leet Code meeting
Time: Mar 28, 2026 10:00 AM Pacific Time (US and Canada)
        Every week on Sat, 110 occurrence(s)
Please download and import the following iCalendar (.ics) files to your calendar system.
Weekly: https://us05web.zoom.us/meeting/tZYocuqgqzMuH9IuHUphHIiZ_4T4IndJLToX/ics?icsToken=DJFc88pL6-me_TneLwAALAAAAA70ShjYgLH6RfEnqUm5LK03v2OgtbXujwlKXRMVgIVWCY9aONPJMCycMlkhyPZ3XSrMVVgXDSYlGF_r7DAwMDAwMQ&meetingMasterEventId=MGJmt5lJTd6mPygcS0hiAQ
Join Zoom Meeting
https://us05web.zoom.us/j/82553858456?pwd=fnK5Vb0CcfFpv0lnouILjeEs2z2Khc.1

Meeting ID: 825 5385 8456
Passcode: 182596

Allen S.

unread,
May 16, 2026, 2:04:55 PMMay 16
to leetcode-meetup
// O(n) time
// O(1) space
func maxBalancedShipments(weight []int) int {
count := 0
for i := 0; i < len(weight) - 1; i++ {
if weight[i] > weight[i+1] {
count++
i++
}
}
return count
}

Anuj Patnaik

unread,
May 16, 2026, 2:06:11 PMMay 16
to leetcode-meetup
class Solution:
def maxBalancedShipments(self, weight: List[int]) -> int:
num_ = 0
running_max = 0
for i in range(len(weight)):
running_max = max(running_max, weight[i])
if weight[i] < running_max:
num_ += 1
running_max = 0
return num_

Bhupathi Kakarlapudi

unread,
May 16, 2026, 2:25:26 PMMay 16
to leetcod...@googlegroups.com
class Solution:
def maxBalancedShipments(self, weight: List[int]) -> int:
ans = 0
mx = 0
for x in weight:
mx = max(mx, x)
if x < mx:
ans += 1
mx = 0 # Reset for the next segment
return ans

--
whatspp group: http://whatsapp.techbayarea.us/
---
You received this message because you are subscribed to the Google Groups "leetcode-meetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leetcode-meet...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/leetcode-meetup/283526c9-5670-4529-aef2-2a59cc3a9622n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages