def soln(points):
# assuming no dup points
dd = collections.defaultdict(set)
for x, y in points:
dd[x].add(y)
ans = 0
for x, y in points:
for _x in [x+1, x+2]:
for _y in [y-2, y-1, y, y+1, y+2]:
if _y in dd[_x]:
ans += 1
for _x in [x]: # it's reduced to a 1D problem
for _y in [y+1, y+2]:
if _y in dd[_x]:
ans += 1
return ans
know the timeline
Apr 18, 20252019 總統盃黑客松 參賽歷程 說明:「資料申請小幫手」專案在 2019 年的時候著重於「政府資料開放平臺」的「新資料需求申請」,以及相關機關答覆的機制,進行探討,我們發現到當時的機關回覆,沒有明確的「不開放、已開放」等有限選項的明確回答,而是一段文字回應敘述。 所以我們就採用人工的方式,把過去 3000 筆申覆案件進行人工標記,讀了機關回答文字敘述後,判定整段話實際上是否同意開放。我們最終得到整體的結果類型如下: 45% 不同意提供資料 25% 民眾申請前已提供資料 13% 同意提供資料 10% 還未回覆 5% 需分案
Apr 21, 2023https://leetcode.com/problems/add-two-numbers/ You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example: Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8
Nov 13, 2022- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next """ edge case:
Sep 28, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up