Blog

play it safe

Content #

谨慎行事,避免危险。it可以省略。不承担风险,待在自己的舒适区。

Life’s too short to play it safe all the time.

From #

重述对方观点

Content #

  • So what you’re (really) saying is … So what you’re saying is, we’re about to get on the plane and you’re dreaming about being back in the office.

  • So you mean that … Well, I suppose I really should start packing my suitcase. So you mean that you’re leaving?

  • If I understand you correctly, … If I understand you correctly, you’d rather stay connected to your work thatn to your best friend.

    ...

数独中网格编号的处理

Content #

用3个数组标记每行、每列、每个子网格已用的数字。

  • row[i]​[x]​:用于标记第i行中的数字x是否出现。
  • col[j]​[y]​:用于标记第j列中的数字y是否出现。
  • grid[k]​[z]​:标记第k个3×3子网格中的数字z是否出现。

把一个9行9列的网格再细分为9个3×3的子网格,在每个子网格内都不允许出现相同的数字,那么我们将9个子网格编号为1~9,在同一个子网格内不允许出现相同的数字。

观察子网格的序号k与行i、列j的关系:

  • 如果把第1~3行转换为0,第4~5行转换为1,第7~9行转换为2,则a=(i-1)/3;
  • 如果把第1~3列转换为0,第4~5列转换为1,第7~9列转换为2,则b=(j-1)/3。

行i、列j对应的子网格编号k=3×a+b+1=3×((i-1)/3)+(j-1)/3+1。

From #

bailian2982(Sudoku)

面对失败

Content #

  • bang one’s head against a brick wall I keep asking her not to park there, but it’s like banging my head against a brick wall.

    I asked for help but felt I was always banging my head against a wall.

  • trial and error Children learn to use computer programs by trial and error.

    After hours of trial and error, Ted cracked the code.

    I learned most of what I know about it through trial and error.

    ...

get through to somebody

Content #

表示让某人明白某事,通常指耗费了很大力气。

How can I get it through to her that this is really important?

From #

stepping stone

Content #

敲门砖,踏脚石

Many students now see university as a stepping stone to a good job.

From #

have a shot with

Content #

尝试,有机会(成功)。 shot在这里表示chance机会的意思。 have a shot with something表示试一下做某事,如果是with somebody通常表示追求某人。 I thought we had a real shot with our model. Richel原本认为他们的AI模型能够有机会成功。

I had a shot with Math before but it didn’t work out.

Do you think I have a shot with that pretty girl?

From #

pitch

Content #

pitch作动词可以表示推销的意思,和persuade说服某人做某事的意思很接近。一般的搭配是 pitch something to somebody 表示向某人推销某物。

For many companies, pitching to investors has become a full-time job.

The new software is being pitched at banks.

From #

sub:Express.js

Content #

Middleware Principles #

Route handlers (app.get, app.post, etc.—often referred to collectively as app.METHOD) can be thought of as middleware that handles only a specific HTTP verb (GET, POST, etc.). Conversely, middleware can be thought of as a route handler that handles all HTTP verbs (this is essentially equivalent to app.all, which handles any HTTP verb; there are some minor differences with exotic verbs such as PURGE, but for the common verbs, the effect is the same).

...

AVL树调整平衡的方法

LL型 #

插入新节点x后,从该节点向上找到最近的不平衡节点A,如果最近不平衡节点到新节点的路径前两个都是左子树L,就是LL型。需要进行LL旋转(顺时针)。

RR型 #

插入新节点x后,从该节点向上找到最近不平衡节点A,如果最近不平衡节点到新节点的路径前两个都是右子树R,就是RR型。需要进行RR旋转(逆时针)。

LR型 #

插入新节点x后,从该节点向上找到最近不平衡节点A,如果最近不平衡节点到新节点的路径前两个依次是左子树L、右子树R,就是LR型。 实际上,也可以看作C固定不动,B进行RR旋转,然后进行LL旋转。

RL型 #

插入新节点x后,从该节点向上找到最近不平衡节点A,如果最近不平衡节点到新节点的路径前两个依次是右子树R、左子树L,就是RL型。 实际上,也可以看作C固定不动,B进行LL旋转,然后进行RR旋转。