2026 April 4 Problems

44 views
Skip to first unread message

daryl...@gmail.com

unread,
Apr 4, 2026, 12:50:46 PMApr 4
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.



2132. Stamping the Grid Hard 35.1%

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


Anuj Patnaik

unread,
Apr 4, 2026, 1:18:28 PMApr 4
to leetcode-meetup
class Solution:
def maximumEvenSplit(self, finalSum: int) -> List[int]:
answer = []
if finalSum%2 == 1:
return []
start = 2
while finalSum >= start:
answer.append(start)
finalSum -= start
start += 2
if finalSum > 0:
answer[len(answer) - 1] += finalSum
return answer

Wang Lijun

unread,
Apr 4, 2026, 1:39:53 PMApr 4
to leetcode-meetup
class Solution:
def minTimeToType(self, word: str) -> int:
res = 0
s = "a"+word
for i in range(1, len(s)):
pre = s[i-1]
c = s[i]
# counterclock wise move
move_time = abs(ord(c) - ord(pre))
if move_time > 13:
# clock wise move
move_time = 26 - move_time
res += move_time + 1
return res

On Saturday, April 4, 2026 at 9:50:46 AM UTC-7 daryl...@gmail.com wrote:

Rudy W

unread,
Apr 4, 2026, 2:33:23 PMApr 4
to leetcod...@googlegroups.com
class Solution:
def minTimeToType(self, word: str) -> int:
res = 0

# current pointer
cur = 'a'
for c in word:

if cur != c:
# there are 26 letters from a - z
# using built-in ord() func to calculate the ASCII value of each letter
# no negative values -> use absolute function
# clockwise
clockwise_cost = abs(ord(cur) - ord(c))

# counter-clockwise
# going counter-clockwise we just need to subtract the clockwise_cost with the number of letters from a-z
counter_cost = abs(clockwise_cost - 26)

if clockwise_cost < counter_cost:
res += clockwise_cost
else:
res += counter_cost
# remember to update the current pointer position
cur = c

# type a char
res += 1

return res


--
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/fa56a07d-5abc-4adc-8475-c755c17e4cfcn%40googlegroups.com.

Anuj Patnaik

unread,
Apr 4, 2026, 2:34:10 PMApr 4
to leetcode-meetup
class Solution:
def minTimeToType(self, word: str) -> int:
time = 0
curr = 'a'
for i in range(len(word)):
difference = abs(ord(word[i]) - ord(curr))
if difference > 13:
difference = 26 - difference
time += difference + 1
curr = word[i]
return time

Wang Lijun

unread,
Apr 4, 2026, 11:19:24 PMApr 4
to leetcode-meetup
class Solution:
def maximumEvenSplit(self, finalSum: int) -> List[int]:
if finalSum % 2 != 0:
return []
res = []
cur = 2
while cur <= finalSum:
res.append(cur)
finalSum -= cur
cur +=2
res[-1] += finalSum
return res

Wang Lijun

unread,
Apr 4, 2026, 11:38:43 PMApr 4
to leetcode-meetup
class Solution:
def maximumEvenSplit(self, finalSum: int) -> List[int]:
if finalSum % 2 != 0:
return []
res = set()
cur = 2
s = 0
while s <= finalSum: # 0,2,4,8,10 ...finalSum
res.add(cur)
s += cur
cur +=2
if s == finalSum:
return res
res.discard(s - finalSum)
return res
Reply all
Reply to author
Forward
0 new messages