2026 April 25 Problems

28 views
Skip to first unread message

daryl...@gmail.com

unread,
Apr 25, 2026, 12:49:34 PMApr 25
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.

Medium and hard problems are carried over from last week.


3853. Merge Close Characters Medium 54.6%


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 25, 2026, 12:54:07 PMApr 25
to leetcode-meetup
class Solution:
def firstMatchingIndex(self, s: str) -> int:
low = 0
high = len(s) - 1
while low <= high:
if s[low] == s[high]:
return low
else:
low = low + 1
high = high - 1
return -1

Bhupathi Kakarlapudi

unread,
Apr 25, 2026, 2:02:46 PMApr 25
to leetcod...@googlegroups.com
class Solution:
def firstMatchingIndex(self, s: str) -> int:
strlen = len(s)
i = 0
while( i < strlen):
if s[i] == s[strlen-1-i]:
return i
i += 1
return -1

--
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/1d351f91-216a-49b1-8399-72774116ebe6n%40googlegroups.com.

Shahaj Vijayan

unread,
Apr 25, 2026, 2:23:11 PMApr 25
to leetcod...@googlegroups.com


Solution 

class Solution {
public int firstMatchingIndex(String s) {
int len = s.length();
for (int i=0 ; i<= len/ 2; i++) {
if (s.charAt(i) == s.charAt(len - i - 1)) {
return i;
}

}
return -1;
}
}


Thanks 

Shahaj Vijayan 



--
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/1d351f91-216a-49b1-8399-72774116ebe6n%40googlegroups.com.


--
Thanks

Shahaj Vijayan

Jagrut

unread,
Apr 25, 2026, 3:17:27 PMApr 25
to leetcode-meetup
class Solution:
def firstMatchingIndex(self, s: str) -> int:
n = len(s)
for i in range(0, n):
if s[i] == s[n - i - 1]:
return i
return -1

3853. Merge Close Characters Medium 54.6%

class Solution:
def mergeCharacters(self, s: str, k: int) -> str:
st = list(s)
keep_going = True
start = 0
while keep_going:
keep_going, start = self.merge(st, k, start)
return ''.join(st)

def merge(self, st: list, k: int, start: int) -> tuple[bool, int]:
for i in range(start, len(st)):
for j in range(i + 1, min(i + k + 1, len(st))):
if st[i] == st[j]:
st.pop(j)
return True, max(0, i - k)
return False, -1
Reply all
Reply to author
Forward
0 new messages