Weekly Notes 0002: Restarting, Games, and Perfectionism
Weekly notes on restarting a game character, perfectionism, memory, and small personal observations.
Weekly notes on restarting a game character, perfectionism, memory, and small personal observations.
「我發現我對於精練之事著迷,例如程式與詩。」
Pseudocode:
1 | 精煉のことが好きのきついした、プログラミングとか詩とか |
如果要保留你原本的語氣,可以改成:
1 | 精練なものに惹かれる。プログラミングや詩など。 |
如果想完整表達「我發現自己對精煉的事物著迷,例如程式和詩」這種敘述,可以說:
1 | 精練なものに惹かれる自分に気づいた。プログラミングや詩など。 |
「とか〜とか」的正確用法是列舉兩個以上的例子,表現「像~啦~啦這些」的感覺,口語、稍微隨性。
如果想用「プログラミングとか詩とか」這個格式,正確的句子可以像這樣:
1 | プログラミングとか詩とか、精練なものに惹かれる |
📚 小補充:
這是「惹く(ひく)」的被動形。意思是「被吸引、被打動」。
例句:
1 | 彼の言葉に惹かれた。 |
📖 例句:
1 | 彼の詩は、言葉を精練して生み出された芸術だ。 |
📝 小解析:
整句很有N2考題喜歡的「抽象描述+具體例子」感覺。
除草,單純想在這裡 dump 一些想法。
安排班夫行程。火車臥鋪肖貴。還在觀望機票和行程,希望不要售罄
這週處理 3 個任務
studiolib dataroot-hip with global-main思緒上有點喘不過氣,聽說是職業倦怠的徵兆…
なんか、頭をリセットする方法ないかな。
both logical and physical separation of components
All components are located in the same machine. e.g. Maya, Photoshop…
client-server architecture
client-backend-database. e.g. blog
decoupled. it’s easier to maintain. so, for example, we should not store business logic in the database. Also, it is easier to be scaled.
layers represent the conceptual/logical organization of the code (code level)
tiers represent the physical separation of components.
can search words by prefix in time complexity, O(n).
1 | package main |
output
1 | [ apple cat category] |
1 | type TrieNode struct { |
Quick sorting is a pre-order traversal operation. Every time we dive into a node, we divide it into two portions: small and large. Then recursively apply this logic to these two portions.
Let’s compare the two implementations below. The first one is straightforward, and the other one uses struct.
#1
1 | func quicksort(array []int) []int { |
#2
1 | type Partition struct { |
In Go, array can only be created by constant int
1 | arr := [4]int // works |
Thus use slice, if we want to implement a function that create a N size matrix
1 | func newMatrix(s int) [][]int { |
1 | func newMatrix(s int) [][]int { |
more flexiable!
1 | func newMatrix[T any](s int) [][]T { |
Usage
1 | m := newMatrix[unit](3) // [[0 0 0] [0 0 0] [0 0 0]] |
Given a slice a. There are 2 sub slices. One’s length is k, the other’s is p.
These 2 sub slices are not overlaid. Find the max sum of the 2 sub slices.
Return -1 if can’t find one.
Example 1:
1 | Input: [1,3,4,7,5,8,2,9], 3, 2 |
Example 2:
1 | Input: [1,3,4,7,5,8], 100, 2 |
Move slice K through A, at the left and right side of K place the slice P.
To improve the efficiency, store sums of K and P in hash tables.


1 | func maxSum(a []int, k, p int) int { |
Given a string s, return a cropped which max length is n.
Also, spaces at prefix and postfix need to be removed.
Example 1:
1 | Input: "Hello World", 8 |
Example 2:
1 | Input: " Hello World ", 100 |
Example 3:
1 | Input: "Hello World", 3 |
Find the start point l and end point r then return result s[l:r]
Left point is easy to find. If s[l] is space, pointer l move right.
On the other hand, r starts from l + N, if s[r] is NOT space, pointer r move left.

The tricky point is that if the given string’s length equals to given n,
and the string ends with character, the last word would be cropped.
Example:
1 | Input: "Learn Golang", 12 |
An easy solution is to append a SPACE to the given string at the beginning.

1 | func crop(s string, n int) string { |