jyhsia5174.github.io

Follow me on GitHub

Profile (JYHSIA)

Hsia, Jui-Yang (夏睿陽)

2021 Weekly Challenge !!

Seek More Challenge Score “The day we stop learning is the day we die” by Michael Scott, The Warlock

Become a Top SWE (Read it evaryday!)

Git Repo

Algo DashBoard

Explore

test

Evaluation Result

“Understanding what is true is essential for success, and being radically transparent about everything, including mistakes and weaknesses, helps create the understanding that leads to improvements.” by Ray Dalio.

Plan & Note

Week 18 (5/10)

5 / 14

SYSTEM instructions are used to access system functionality that might require privileged access and are encoded using the I-type instruction format. These can be divided into two main classes: those that atomically read-modify-write control and status registers (CSRs), and all other potentially privileged instructions.

5 / 13
  • Prep for team match
    • Understand Google big goal and direction
    • Get list of team and project details
    • Prepare question to ask
      • Prject fit with Google Goal
      • todo
  • OS
    • For fun and secret goal (wwwwwwwwwwww).

verilog

5/ 12

verilog developer: Prabhu Goel, Phil Moorby, Chi-Lai Huang, and Douglas Warmke company: Cadence Design Systems, Inc.

Algo

  • Kuhn’s Algorithm for Maximum Bipartite Matching
    1. base version
    2. O(node^2) version
    3. https://codeforces.com/blog/entry/17023
    4. https://codeforces.com/blog/entry/58048
  • Hopcroft–Karp Algorithm

Quates I am pondering

“So just going all the way down. Understanding everything under you. It’s really important to not abstract away things. You need to have a full understanding of the whole stack.” by Andrej Karpathy video

Week 17 (5/3)

Week 16 (4/26)

Funny stuff

Feynman’s Orange Juice Song

  • submit attendance record (5/5(三)下午5:00前繳交4月份助教出勤記錄表至R205系辦公室)
  • ca homework 4 (Due: May 5 by 2:20pm) (draft finish before Sun. Dived into details in Mon. night & Tue. morning! Otherwise, what’s the point of doing something that can be easily achieved. It’s not intersting and optimal.)
  • MS interview
  • G interview
  • CA mid exam score reveal.

Distraction (tag: mindset)

Material source:

prob:

  • is distracted from “pre-defined task”
  • s1: understand the underlying emotion
  • s2: finding the root cause of emotion
  • s3: resolving the emotion

ex:

  • anxiety about the way I practice.
  • fear about choosing the wrong problem to practice and fail the interview
  • unable to focus on training
  • seek dopamin releasing activity (ex: youtube, manga, …, etc) or do sub-optimal task (ex: replying email, do noncritical paper work, …, etc)

sol:

  • define meta goal above interview (ex: acheiving international grandmaster in codeforce)
  • define why meta goal should be acheived (ex: acquire a solid algo foundation, practice to master a skill)
  • remind myself about the meta goal. Anything else is unnecessary.
  • build training task based on the meta goal.

exec: Meta training.

Quate I am Pondering

Source: Stoic Quotes On Confronting And Discarding Anxiety

When I see an anxious person, I ask myself, what do they want? For if a person wasn’t wanting something outside of their own control, why would they be stricken by anxiety? — Epictetus
“Caretake this moment. Immerse yourself in its particulars. Respond to this person or that person, this challenge, this deed. Quit the evasions. Stop giving yourself needless trouble. It is time to really live; to fully inhabit the situation you happen to be in right now. You are not some disinterested bystander. Participate. Exert yourself.” — Epictetus
Man is not worried by real problems so much as by his imagined anxieties about real problems. — Epictetus
“It’s ruinous for the soul to be anxious about the future and miserable in advance of misery, engulfed by anxiety that the things it desires might remain it’s own until the very end. For such a soul will never be at rest— by longing for things to come it will lose the ability to enjoy present things.” — Seneca
Don’t let your reflection on the whole sweep of life crush you. Don’t fill your mind with all the bad things that might still happen. Stay focused on the present situation and ask yourself why it’s so unbearable and can’t be survived. —…

Week 15 (4/19)

Reflection

  1. master theorem is not familiar with.

training tag

1. tarjan
2. scc
- kosaraju
4. hamilton
5. mst
- kruskal 
- prime
6. euler path
7. Hungarian Algorithm
backtrack *
graph ****
tree *
dfs *
bfs
trie
recursion
3. div & conquer *
4. dp ***
6. stack (calculator)
8. string *
20. rolling hash *
21. Suffix Array *
22. suffix array + lcp *

use scc to convert graph to dag

  • scc
  • remove self-loop
  • remove duplicate edge

dfs graph edge classification:

  • tree edge
  • back edge
  • forward edge
  • cross edge

good material source

Reflection

  • Problem oriented training is more efficient to master a knowledge.
  • Support with high-level knowledge guide map.

interesting stuff

David Eagleman: https://eagleman.com/

Rahul Jundial: http://drjandial.com/

Max Lugavere: https://www.maxlugavere.com/

Moran Cerf: https://www.morancerf.com/

V.S. Ramachandran: http://cbc.ucsd.edu/ramabio.html

Andrew Huberman: https://www.hubermanlab.com/

Week 14 (4/12)

  1. Bellman ford
    • dp[i][k] + dp[k][j] can overflow if initialize is INT_MAX
    • remember to init dp[i][i] = 0
  2. Tree seg
  3. Odd even middle
  4. MST

training tag

backtrack *
tree
dfs
bfs
graph
trie
recursion
3. div & conquer
4. dp
6. stack (calculator)
8. string *
20. rolling hash
21. Suffix Array

opt tag

22. geometry
19. line swap
2. bisearch
11. union find
16. orderedmap
7. bit munipulation
15. minmax
18. random
19. sufix-array linear complexity algo SA-IS
20. RMQ sparse table
21. Ukkonen's algorithm is a linear-time, online algorithm for constructing suffix trees

Week 12 (3/29)

  • Result

  • Plan

Goal: catch blind spot

Task Reason Consequence of no doing Progress
Codeforce Div1 ABCD pushing the limits live in the bubble 4 / 5
equal range templeate concrete the implementation unstable implementation 1 / 1
Fenwick tree templeate concrete the implementation unstable implementation 0 / 1
Suspended —– —– —–
seg tree templeate concrete the implementation unstable implementation 0 / 1
rolling hash template concrete the implementation unstable implementation 0 / 1
suffix array concrete the implementation unstable implementation 0 / 1
doubly linked list template concrete the implementation unstable implementation 0 / 1
scc template concrete the implementation unstable implementation 0 / 1
dfs template concrete the implementation unstable implementation 0 / 1
  • Not familiar tags
    1. string
    2. dp
    3. divide and conquer
    4. bi search implementation

Week 12 (3/22)

  • Result

  • Plan

Goal: catch blind spot

Task Reason Consequence of no doing Progress
Codeforce Div1 ABCD pushing the limits live in the bubble 4 / 5
equal range templeate concrete the implementation unstable implementation 0 / 1
Fenwick tree templeate concrete the implementation unstable implementation 0 / 1
seg tree templeate concrete the implementation unstable implementation 0 / 1
rolling hash template concrete the implementation unstable implementation 0 / 1
suffix array concrete the implementation unstable implementation 0 / 1
doubly linked list template concrete the implementation unstable implementation 0 / 1
scc template concrete the implementation unstable implementation 0 / 1
dfs template concrete the implementation unstable implementation 0 / 1
Suspended —– —– —–
  • Not familiar tags
    1. string
    2. dp
    3. divide and conquer
  • Reflection
    1. OS & Network knowledge

Week 11 (3/15)

  • Result

  • Plan

Goal: catch blind spot

Task Reason Consequence of no doing Progress
Codeforce constext ABCD pushing the limits live in the bubble 4 / 5
dp 4 confront the weakness slow learning curve 3 / 4
divide and conquer 4 confront the weakness slow learning curve 1 / 4
string 4 confront the weakness slow learning curve 0 / 4
gcd, floor, ceil function confront the weakness slow learning curve 1 / 1
equal range templeate concrete the implementation unstable implementation 0 / 1
Fenwick tree templeate concrete the implementation unstable implementation 0 / 1
seg tree templeate concrete the implementation unstable implementation 0 / 1
rolling hash template concrete the implementation unstable implementation 0 / 1
suffix array concrete the implementation unstable implementation 0 / 1
doubly linked list template concrete the implementation unstable implementation 0 / 1
scc template concrete the implementation unstable implementation 0 / 1
dfs template concrete the implementation unstable implementation 0 / 1
Suspended —– —– —–
  • Not familiar tags
    1. string
    2. dp
    3. divide and conquer
  • Reflection
    1. OS & Network knowledge
    2. rethink edu16D solution

Week 10 (3/8)

  • Result

  • Plan

Goal: catch blind spot

Task Reason Consequence of no doing Progress
Codeforce constext ABCD pushing the limits live in the bubble 4 / 4
Practice problems from not ready tags confront the weakness slow learning curve 6 / 16
equal range templeate concrete the implementation unstable implementation 0 / 1
Fenwick tree templeate concrete the implementation unstable implementation 0 / 1
seg tree templeate concrete the implementation unstable implementation 0 / 1
rolling hash template concrete the implementation unstable implementation 0 / 1
suffix array concrete the implementation unstable implementation 0 / 1
doubly linked list template concrete the implementation unstable implementation 0 / 1
scc template concrete the implementation unstable implementation 0 / 1
dfs template concrete the implementation unstable implementation 0 / 1
Suspended —– —– —–
  • Not familiar tags
    1. string
    2. dp
    3. divide and conquer
    4. rethink edu16D solution
  • Reflection
    1. OS & Network knowledge

Week 9 (3/1)

  • Result 80

  • Plan

Goal: catch blind spot

Task Reason Consequence of no doing Progress
Codeforce edu 8 virtual pushing the limits live in the bubble 7 / 8
Binary search template concrete the implemenatation unstable implementation 1 / 1
equal range templeate concrete the implementation unstable implementation 0 / 1
Fenwick tree templeate concrete the implementation unstable implementation 0 / 1
seg tree templeate concrete the implementation unstable implementation 0 / 1
rolling hash template concrete the implementation unstable implementation 0 / 1
suffix array concrete the implementation unstable implementation 0 / 1
evaluate USACO explore more materials live in the bubble 0 / 1
Suspended —– —– —–
  • Reflection
    1. power(x) function
    2. in prime ring a^(p-1) = 1 => a^(-1) = a^(p-2)
    3. OS & Network knowledge
    4. dp scare the crap out of me
    5. uneasy about backtrack
    6. doubly link list template
    7. backpack problem
    8. dfs template
    9. circle detection template
    10. scc template

Week 8 (2/22)

  • Plan

Goal: catch blind spot

Task Reason Consequence of no doing Progress
Mock 5 round Don’t hide from reality Not improving 4/ 5
codeforce edu 4 Practice more harder problem set Life in lie 3 / 4
Suspended —– —– —–
List all basic data structure & practice it if I am not familiar with it High-level review my week spot growing blind spot 0 / all
Redo problem over 100 readiness score. Target number is 45. Review past failure and overcome it. Not improving. 3 / 45
  • Reflection
    1. review binary search template
    2. create code template for equalrange
    3. Fenwick tree / seg tree
    4. USACO
  • Rolling hash
typedef long long int lli;
lli m = 10e9+9;
lli p = 31;

lli hash( const string &s ){
    lli res = 0;
    for(int i = 0; i < s; i++){
        res = (res * p + (s[i] - 'a' + 1) ) % m;
    }
    return res;
}

Week 7 (2/15)

  • Plan
task reason consequence of no doing
Break the bubble (Do 2 sim-interview) The fear of being wrong should be overcome Growing Blindspot
Find seg tree & KMP problem I need to practice for interview 1. don’t get a job
Take TA courses I already commited to CJ that I will take TA position. 1. piss of CJ
leave lab
Compiel Gauss Newton PDF I feel like I have to complete a thing if it has stared
feel guilty about taking money without doing research
1. piss of CJ
leave lab
Suspended —– —–
Google Problem (40) I need to practice for interview 1. don’t get a job
  • Reflection
  1. Each time think of recursive problem, think of dynamic programming.
  2. The burn out principle work! Keep that rule.
  3. Code book.

Week 6 (Spring festival)

  • I feel like that I stuck in between ‘I should work’ & ‘I don’t feel like to’.
    1. Result: read books / youtube / netflix
    2. Kind of feel guilty about not working. (Expetation / Reality mismatched )
  • Overestimated my ability to overcome the enviroment factor (Comformity)
    Conformity is the act of matching attitudes, beliefs, and behaviors to group norms, politics or being like-minded. Norms are implicit, specific rules, shared by a group of individuals, that guide their interactions with others.
    
  • I do not have a strong why to take spring festival. This may leads to that I don’t feel that I ‘live’ my life.

  • Binary Search
    int left = 0, right = nums.size() - 1;
    while(left <= right){
      // Prevent (left + right) overflow
      int mid = left + (right - left) / 2;
      if(nums[mid] == target){ return mid; }
      else if(nums[mid] < target) { left = mid + 1; }
      else { right = mid - 1; }
    }
    /*
    sub     len break?  mid lsub    llen    rsub    rlen
    [0,-1]  -1  y
    [0,0]   1   n       0   [0,-1]  -1      [1,0]   -1
    [0,1]   2   n       0   [0,-1]  -1      [1,1]   1
    [0,2]   3   n       1   [0,0]   1       [2,2]   1
    [0,3]   4   n       1   [0,0]   1       [2,3]   2
    [0,4]   5   n       2   [0,1]   2       [3,4]   2
    */
    
int left = 0, right = nums.size();
while(left < right){
    // Prevent (left + right) overflow
    int mid = left + (right - left) / 2;
    if(nums[mid] == target){ return mid; }
    else if(nums[mid] < target) { left = mid + 1; }
    else { right = mid; }
}
/*
sub     len break?  mid lsub    llen    rsub    rlen 
[0,-1)  -1  y
[0,0)   0   y
[0,1)   1   n       0   [0, 0)  0       [1, 1)  0
[0,2)   2   n       1   [0, 1)  1       [2, 2)  0
[0,3)   3   n       1   [0, 1)  1       [2, 3)  1
[0,4)   4   n       2   [0, 2)  2       [3, 4)  1
*/
int left = 0, right = nums.size() - 1;
while (left + 1 < right){
    // Prevent (left + right) overflow
    int mid = left + (right - left) / 2;
    if (nums[mid] == target) {
        return mid;
    } else if (nums[mid] < target) {
        left = mid;
    } else {
        right = mid;
    }
}
/*
sub     len break   mid lsub    lLen    rsub    rLen
[0,-1]  0   y
[0,0]   1   y
[0,1]   2   y
[0,2]   3   n       1   [0,1]   2       [1,2]   2
[0,3]   4   n       2   [0,2]   3       [2,3]   2
[0,4]   5   n       2   [0,2]   3       [2,4]   4
*/

Week 5 (2/15)

  • Algorithm
  1. read problem and test cases!! Don’t rush to write code.
  2. KMP algo.
  3. segmentation tree structure
  4. reduced segmentation tree structure
  5. binary search termitation condition

Week 4 (Burnout)

  • Unsuccessful defense against bunrout:

Consequences:

  1. Unproductive at Fri, Sat and Sun.
  2. Feel bad about myself.
  3. Disrupted life style (poor sleep quality / bing-watch Netflix & Youtube / Insufficient excercise )

Possible sourece:

  1. Gauss-Newton EXP
  2. Interview meeting with Google HR.
  3. Interview bomb from Shoppee.
  4. Lab funding plan and reimbursement.
  5. Unintended commitment toward software development.
  6. Uncatched self-challenged progress.
  7. Extensive working on CV, which is deeply related to my self-worth and validation.

Possible solution:

  1. Seek out companion to reduce anxiety.
  2. Prioritize and Execute. Remake a workable schedule.
  3. Meditation and Exercise.

Week 3

  • The relation between level and node of tree:

level 0: 2^(0+1) - 1 = 1

level 1: 2^(1+1) - 1 = 2

level k: 2^(k+1) - 1

  • Not familiar with recursion struction:

The function may contain (state) and in the function needs a terminatoin criteria.

“Backtracking is a rather typical recursive algorithm, and any recursive algorithm can be rewritten as a stack algorithm.” from (https://www.cis.upenn.edu/~matuszek/cit594-2012/Pages/backtracking.html)

  • Common prefix of a set of strings : Trie.

  • LinkList-hashmap structure:

O(1) query from key

O(1) swap any two element order

O(1) remove head or tail element

  • C++ random generator (TODO)

  • encode integer to string (TODO) 297 Serialize and Deserialize Binary Tree