2026 July 11 Problems

33 views
Skip to first unread message

daryl...@gmail.com

unread,
Jul 11, 2026, 12:42:41 PMJul 11
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.





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,
Jul 11, 2026, 1:43:37 PMJul 11
to leetcode-meetup
class Solution:
def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int:
count = 0
arr2.sort()
i = 0
j = 0
while i < len(arr1):
if (-d > arr1[i] - arr2[j] or arr1[i] - arr2[j] > d) and j < len(arr2) - 1:
j += 1
else:
if -d <= arr1[i] - arr2[j] and arr1[i] - arr2[j] <= d:
i += 1
j = 0
else:
if (-d > arr1[i] - arr2[j] or arr1[i] - arr2[j] > d) and j == len(arr2) - 1:
count += 1
j = 0
i += 1
return count



Jagrut

unread,
Jul 12, 2026, 4:09:02 PMJul 12
to leetcode-meetup
class Solution:
def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int:
clean_count = 0
for a in arr1:
if all(abs(a - b) > d for b in arr2):
clean_count += 1
return clean_count

Jagrut

unread,
Jul 12, 2026, 5:28:57 PMJul 12
to leetcode-meetup
class Solution:
def minOperations(self, nums: List[int], x: int) -> int:
target = sum(nums) - x
if target < 0:
return -1
curr_sum = 0
max_window_size = -1
left = 0
for right in range(len(nums)):
# Incorporate incoming number
curr_sum += nums[right]

# Make sure window satisfies criteria
while left <= right and curr_sum > target:
curr_sum -= nums[left]
left += 1

# Check if window sum is exactly equal to target
if curr_sum == target:
max_window_size = max(max_window_size, right - left + 1)

return -1 if max_window_size == -1 else len(nums) - max_window_size
Reply all
Reply to author
Forward
0 new messages