week report 2024.17

If you stayed at home long enough, the place you live in will become irrelevant.
Entertainment¶
Dave the diver¶
very relaxing causual game, which also makes me think, you have to become some kind of expert before you get old, or else, we don't what kind of life is waiting for you.
Learning¶
We could use datetime, calendar built-in functions to deal with datetime problems in python
-
- Day of the Year
datetime(y,m,d).days
- Day of the Year
-
- Day of the Week
calendar.weekday(year, month, day)
- Day of the Week
classic BFS¶
class Solution:
def openLock(self, deadends: List[str], target: str) -> int:
st = set(deadends)
q = deque(["0000"])
step = 0
while q:
sz = len(q)
for _ in range(sz):
cur = q.popleft()
if cur == target:
return step
# skip already visited pattern
if cur in st:
continue
st.add(cur)
# next pattern
for i in range(4):
plus, minus = "", ""
if cur[i] == "9":
plus = cur[:i] + "0" + cur[i + 1 :]
else:
plus = cur[:i] + str(int(cur[i]) + 1) + cur[i + 1 :]
if cur[i] == "0":
minus = cur[:i] + "9" + cur[i + 1 :]
else:
minus = cur[:i] + str(int(cur[i]) - 1) + cur[i + 1 :]
if plus not in st:
q.append(plus)
if minus not in st:
q.append(minus)
step += 1
return -1
life¶
- finally eased some nerves, spent a lot of time to play games, or should I?
- the days before and between holiday were always kinda meaningless
- the study plan was disrupted
- the working was not progressing
- the fun was just-so-so
- I'd rather go to office regularly to maintain a more disciplined life pace
Sharing¶
- 我发现了“高能量”和“松弛感”的秘诀
- 零和博弈与把一块蛋糕做大的思维差距
References¶
- https://thecoder08.github.io/hello-world.html
- a deep researching of
hello worldin c and unix-system
- a deep researching of