Saturday, November 28, 2020

Tracy song: Bravo! behavior interview sharing - a link

I asked Tracy song to share tips for my coming Google behavior interview. She shared me a link and are willing to offer me a mock interview as well. She told me so last year when we met in San Mateo city, my facebook MPK onsite trip. 

Here is the link. 

I am very good at learning things by reading. When I watch Google recruiter's video, my mind sometimes goes some other places. But reading is so important as writing. I will not miss any thing important. 

That is my style. I always like to write blogs compared to recording youtube.com videos as well. Now I started to record youtube video to share as well. 



Googler - Blog - My favorite notes

Here is the link from Andriy  Buday.  

Here are original bullet points from me:

  • Do your job and do it well. Really well. Master the tools. Balance delivery and long-term perspective.
  • Never ever stop learning. Improve yourself in all areas. Soft and hard skills.
  • Work on projects that have impact and could grow to something big. If you don’t think you are on such a project change the project or change the project.
  • Find a mentor and work with your manager and others to get you where you want to be.
  • Look at what next level implies and do those things. Take responsibilities. Now.
  • Make your work visible and document what you’ve done.
  • Stay healthy. Sleep well.

Friday, November 27, 2020

Prepare for Your Google Interview: Leadership

 Here is the link. 

Googlers share targeted advice for the leadership aspects of Google's interview process. This video will cover tips for communication and leadership style, vision, overall best practices, and more! Skip ahead to: 0:35 - Communication and Leadership Style 1:25 - Working with Teams 2:08 - Vision 2:36 - Navigating Complexity and Ambiguity 3:07 - Delivering Results 4:01 - Best Practices Explore open jobs and internships at Google around the world → https://goo.gle/2ZjYZp3 Learn about how Google interviews and hires → https://goo.gle/2IGcoCY Subscribe to Life at Google for more videos → https://goo.gl/kqwUZd


Evaluate you project 

We'll be looking for: 

  • Define clear goals
  • Develop a plan
  • Delegate tasks
  • Manage progress
  • Maintain focus
Remain adaptable and offer space for creativity 

Explain thought process - how to solve the problems? 
Share with moments - Get it right 

We will be evaluating you on: 
  1. Communication and leadership style
  2. Navigating complexity and ambiguity
  3. Working with teams
  4. Vision 
  5. Delivering results
Authentic, knowledge, humble ...
Not most knowledge person in the room

Vision - change the world - make it better 
status quo - how we do things 



Tips From a TV Pro - Look and Sound Your Best On Zoom! | Dominique Sachse

 Here is the link. 

Sound like a pro - 

Keep the laptop close to you. 

Commands attention ......

Good light 


How To Look Good on Video Calls | Zoom FaceTime Skype | Blogger Secrets!

 Here is the link. 



Zoom Interview Tips | Strategies for Acing Online Interviews and Calls

 Here is the link. 

In this lesson, I give you my 2 amazing hacks to help you ace your online interview. If you're having the interview on Skype, Zoom, WebEx, Adobe Connect or some other online interview software, you'll be able to use my tricks here to help you ace your video call and get hired for the job you want! More and more, recruiters are reaching out first over video call so you want to be as comfortable as possible with online interviews. My steps are easy to use and a huge game-changer when it comes to online interview performance. You're going to want to be interviewed online after learning my strategies :)


How to Look Good on Video Calls - Skype, Zoom, FaceTime | Video Interviews

 Here is the link. 

Many of you are faced with the situation where you’ll have to run meetings remotely via video on different platforms, whether it be Skype, Zoom or some other platform...so today I wanted to share with you my best tips on how to look professional on camera while you have these video calls. If you've been asking "how to look good on video calls", "how to dress for video interviews", then this video is for you!


Put a few books underneath laptop if needed. Therefore the camera is at my eye level.

Lighting - in front of my face - luminate my face

Lighting is so important - sets the tone and how they feel about you

Shape up your face -

chest up - - business on top - normal wear in the office

neutral color - easy on eyes

think about background - Messy person - expose too much

Sound - microphone - echo - not clear

good quality video - listen to what you try to say

Google interview: 24 Most Asked Questions in Interviews at Google

 Here is the link. 

- Why Google Tell me about a situation where you had to solve a difficult problem Tell me about a team project you worked on We all deal with difficult customers from time to time. Tell me about a challenging client-facing situation and how you handled it. Describe a time when you improved a process with limited budget. Tell me about a time when you made sure a customer was pleased with your service. Tell me about a time you had to deal with ambiguity Describe a time when you found it difficult to work with someone from a different background. Tell me about a time when you came up with a new approach to a problem. “Tell me about a time when you missed an obvious solution to a problem Tell me about a time when you took the lead on a difficult project Tell me about a time you recovered from a difficult situation Give me an example of a time you faced a conflict while working on a team. How did you handle that? What's your greatest strength? And weakness? Tell me about the toughest decision you've had to make in the past six months Describe a long-term project that you managed. How did you keep everything moving along in a timely manner? Everyone starts somewhere. Talk about a time when you were new on the job and had a lot to learn. How did you manage that? an example when you had to push back to HQ or challenged a decision Tell me about a time when you worked with a difficult team member. Let’s say you need something important from a coworker and that person isn’t responding. How would you deal with this? a time when you faced a problem that had multiple possible solutions What did you do when you needed to motivate a group of individuals? Let’s say you’re working on a major project and you’re in the weeds. How do you find your way out? Tell me about a time when you were not able to meet a time commitment. What prevented you from meeting it? What was the outcome and what did you learn from it? Google’s 10 things: https://www.google.com/about/philosop...

Thursday, November 26, 2020

Interview skills: Prepare for your Google Interview: Tips and Example General Cognitive Ability Question

 Here is the link. 

GCA - congnitive ability

past vehavior - 

real life situation you may face

What is a GCA interview? 

Evaluation of your problem solving skills

Insight into ......

What is Google assessing? 

Understanding of the question

Preparation strategy

Ability to identify solutions

Justification for a specific solution 

Communication


4:55/ 11:02

Framework - how to build strong response? 

  • Take a moment before responding
  • Ask clarifying questions
  • Share logical assumptions
  • Show your work
  • Consider the pros and cons
  • Think about how you measure success
  • Tie it back to the role

EXPR stock: My research

 

I like to look into other retail clothing store stocks. I like to figure out how many Robinhood investors will speculate on those stocks, and I like to take chance to invest as well. 


  1. EXPR
  2. FRAN
  3. CAL
  4. DBI
  5. GCO
  6. CTRN
  7. CHS
  8. XELB
  9. PXL
Finviz - YTD peroformance 90% loss



Leetcode discuss: First practice - 1368. Minimum Cost to Make at Least One Valid Path in a Grid

 Here is the link. 

First practice - C# - BFS - Case study

Nov. 23, 2020
Introduction
From the comment on the article about Google onsite interview, I decided to work on this hard level algorithm. I tried to think about how to solve it by myself, but I could not come out the details using BFS to solve it. I need to work on a small example, step by step, try to solve it by hand first.

Case study
grid = [[1,1,1,1],[2,2,2,2],[1,1,1,1],[2,2,2,2]]
Output: 3
How to solve the problem ?
Record minimum cost for each position in the matrix.

cost[0][0] = 0,
Apply BFS algorithm, start from (0,0), go right to (0, 1) or go down to (1, 0).
grid[0][0] = 1 which is to go right, so cost[0][1] = 0, no need to change the direction.
But cost[1][0] = 1 since direction should go down.
so the cost matrix
0, 0, ?, ?
1, ?, ? , ?
?, ?, ?, ?
?, ?, ?, ?
Next step is to put position (0, 1) and (1, 0) to the queue, and continue to apply BFS algorithm.
Check (0, 1), there are three directions, go left or right or down. Go right, no cost. Go left, cost 1, but cost(0,0) = 0, new path is bigger than 0. Ignore.
Cost matrix is the following:
0, 0, 0, ?
1, 1, ?, ?
?, ?, ?, ?
Skip rest of steps.

What if the above step to put neighbor nodes of (0,0) down first, right next, (1,0) and (0, 1).
(1, 0) has two directions to go, either go right or go down, so the cost of matrix is updated.
0, 0, ?, ?
1, 2, ?, ?
1, ?, ?, ?
?, ?, ?, ?
(0, 1) has two directions to go, eith go right or go down, so the cost of matrix (1, 1) is 1 < 2, so the minimum cost 1 should replace 2, which is the path from (0, 0) to go down and then go right.

I think that it is important to go over a simple test case step by step, so next time I can figure out how to solve the problem in onsite interview, like Google onsite.

Here are lessons I learn from this practice:

  1. BFS algorithm - the order of neighbor nodes into the queue should not matter in final result. Shortest cost path may not be found first, so it is important to update cost when a new path is found with minimum cost.
  2. It is a graph algorithm. The longer path may have smaller cost.

BFS solution
Declare cost[rows][] array to save minimum cost from (0,0) to (row, col). Apply BFS algorithm, and each step four directions are considered, and then cost will be calculated if the direction is different from the one given in grid[][].

The challenge idea is to find minimum cost to each node (row, col).

Deep thoughts
Nov. 24, 2020 10;35 PM

I asked the interviewee in my mock interview, and then I thought about more carefully. BFS algorithm will exhaust all possible paths, so that minimum cost will be calculated to reach (rows -1 , columns - 1).

If there are two loops, it should not work. The interviewee wrote the solution and I do believe that it will not exhaust all possible paths and each position will have minimum path from start position (0, 0).

The interviewee wrote the code like this:
while i < len(rows)
while j < len(cols)
i, j = calculate_i_j(grid[i][j])
if i > len ...

public class Solution {
    public int MinCost(int[][] grid)
    {            
        var rows = grid.Length; 
        var columns = grid[0].Length; 
        
	    var cost = new int[rows][];
        for(int row = 0; row < rows; row++)
        {
            cost[row] = new int[columns];
        }

	    for (int row = 0; row < rows; row++)
	    {
		    for (int col = 0; col < columns; col++)
		    {
			    cost[row][col] = int.MaxValue;
		    }
	    }
                
	    cost[0][0] = 0;

	    var queue = new Queue<int[]>();
	    queue.Enqueue(new int[]{0, 0});

        //                              right,    left,      down,      up 
        var directions = new int[,] { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } };
        //  1 -> right, 2 <- left, 3 down, 4 up 
        
	    while (queue.Count > 0)
	    {
		    var node = queue.Dequeue();
            var row = node[0];
            var col = node[1];
            
		    int currentCost = cost[row][col];

		    for (int i = 0; i < directions.GetLength(0); i++)
		    {
			    var nextRow = row + directions[i, 0];
			    var nextCol = col + directions[i, 1];
                
                // grid[x][y] has 4 values 
                //  1 -> right, 2 <- left, 3 down, 4 up 
			    int newCost = currentCost + (grid[row][col] == (i + 1) ? 0 : 1); 

			    if (nextRow >= 0 && nextCol >= 0 && nextRow < rows && nextCol < columns)
			    {
                    // current path is shorter one
				    if (newCost < cost[nextRow][nextCol])
				    {
					    cost[nextRow][nextCol] = newCost;
					    queue.Enqueue(new int[]{nextRow, nextCol});
				    }
			    }
		    }
	    }

	    return cost[rows - 1][columns - 1];
    }
}


Wednesday, November 25, 2020

Leetcode discuss: 1368. Minimum Cost to Make at Least One Valid Path in a Grid

 Here is the link. 

Nov. 25, 2020
Introduction
I paid Leetcode premium, and I struggled to learn to solve all those 14 set Google mock onsite interview algorithms. Just after I finished those algorithms, I found this algorithm. It is the best one compared to all those 14 set algorithms. I did come cross this hard level algorithm from an aritcle on Leetcode about Google phone screen written by an anonymous player.

I got stuck in first 15 minutes thinking, since I still have weak muscle in algorithm analysis, and I like to push myself using this hard level one. I solved 560 algorithms, I could code any solution and make it really readable and perfect in logic, efficient.

7 benefits to master the algorithm
I spent over 8 eight hours to read and share three practices. I am still not the master of the algorithm.

My first practice is here. I took BFS approach and work on a case study to help myself think better.

Second practice is here. I made minor changes to apply BFS algorithm, instead of using Queue, I chose to use C# LinkedList - Double linked list, a deque structure to enforce the cost with value 1 to be find first if possible. All nodes in the queue have cost difference less and equal to one.

Third practice is here. I tried the idea to implement the solution using dynamic programming.

Here are highlights:

  1. Learn how to use BFS/ DFS, and also make minor modification from Queue to Deque;
  2. Understand how to modify a medium level problem to find minimum path to a hard level one. This one is to add direction and cost to change direction, and make this subproblems are hard to define using dynamic programming.
  3. This algorithm can help to solve a few other medium level algorithms, graph algorithms in general, minimum cost/ minimum distance/ greedy algorithm/ data structure.
  4. Be humble. Since I was nervous when I thought about how to solve it by myself. I did not solve it before I came cross two day ago. I need to learn how to work on a simple case first.
  5. I took distributed system and distributed algorithm, ad hoc network graduate course from 2002 to 2003 in Florida Atlantic University, but I did not write any code to help me understand the theorem. Now I practice a lot but I did not go back to learn and review more about theorems. Best way to learn is to practice a lot of algorithms first, and it will be easy to take any of those courses.
  6. Play a simple test case very well in practice, and it will really help reduce stress in the interviews as an interviewee. Graph algorithm is tough but usually it can be solved using DFS/ BFS or union find algorithm.
  7. As an interviewer, I can use the hard level algorithm to interview. Understand different stages of common mistakes, BFS/ DFS idea lacking, or other things.

I think that most important is to stay humble, continue to practice more hard level algorithm. Choose a hard level algorithm and really practice very well. Come back to review the algorithm very often as well.

Common mistakes - my mock interview as an interviewer
I can learn a lot to ask interviewees to solve the problem.
I asked the algorithm in mock interview as an interviewee, and the interviewee surprised me with bugs to write two while loop without thinking about BFS or DFS to cover all paths.

My first interviewee with buggy pseudo code.

def calculate_i_j(val):
    if val == 1:
        i = i
        j = j+1
    return i, j 
    

def modify_direction()
     return [possible_1 , possible_3]  # pair (i,j)

-- modification to find minimum cost 
calculate i, j from the current position's value
def find_Path()
    min_cost = 0 
    dp = 
    while i < len(rows) 
        while j < len(cols):
             cur_i, cur_j = calculate_i_j(grid[i][j])  // all directions -> 
             list_of_possible = modify_direction(i,j)
             for dir in list_of_possible:
                  i, j = dir
                  if i, j == cur_i, cur_j:
                      dp[i,j] = min(dp[i-1, j) , dp [i+1,j], dp[i,j+1], dp[i, j-1])
                  else:
                      dp[i,j] = 1+min(dp[i-1, j) , dp [i+1,j], dp[i,j+1], dp[i, j-1])
                  findPath(i,j)


-- old version has a bug
calculate i, j from the current position's value
def find_Path()
    min_cost = 0 
    while i < len(rows) 
        while j < len(cols):
             i, j = calculate_i_j(grid[i][j])
             if i >len(rows) or j > len(cols) or i< 0 or j <0: # crossing the boundaries

                  list_of_possible = modify_direction()
                  for dir in list_of_possible:
                       cost = 1+ find_Path(dir[0], dir[1])
                       min_cost = min(cost, min_cost)                     
    recursively_move(i, j)
end

Interviewee asked feedback and hints

  1. Missing dp[row, col], save every position minimum cost
  2. Exhaust all paths, use data structure, BFS, use Queue for example.

Improve analysis:
Work on a simple matrix 2 x 2.

all possible (0,0) -> (1, 1)
<- <- maximum cost -> rows + columns -> 0 -> binary search
-> ->

all paths -> miss a path -> all paths
snake - rows * columns - length ->cost 0 ->
paths -
complexity -
reduce
BFS / DFS - queue

(0,0) -> possible analysis - space, complexity

dp[i, j]  - minimum cost from (0,0) to (i, j)
exhaust all paths - (3, 3) - keep minimum cost - path - minimum 3 -> 5 <- 
current minimum cost -> 3    

<-  -> ->  ->1    
<-1 -> 2<-1 <-  <- 
->  -> ->  -> 
<-  <- <-  <- 

Go over (1, 1) position, from left, cost is 1, and from right cost is 2
<-  -> ->  ->1    
<-1 -> 2<-1 <-  <- 
->  -> ->  -> 
<-  <- <-  <- 

BFS - breadth first search 

Leetcode discuss: 1368. Minimum Cost to Make at Least One Valid Path in a Grid

 Here is the link. 

First practice - C# - BFS - Case study

Nov. 23, 2020
Introduction
From the comment on the article about Google onsite interview, I decided to work on this hard level algorithm. I tried to think about how to solve it by myself, but I could not come out the details using BFS to solve it. I need to work on a small example, step by step, try to solve it by hand first.

Case study
grid = [[1,1,1,1],[2,2,2,2],[1,1,1,1],[2,2,2,2]]
Output: 3
How to solve the problem ?
Record minimum cost for each position in the matrix.

cost[0][0] = 0,
Apply BFS algorithm, start from (0,0), go right to (0, 1) or go down to (1, 0).
grid[0][0] = 1 which is to go right, so cost[0][1] = 0, no need to change the direction.
But cost[1][0] = 1 since direction should go down.
so the cost matrix
0, 0, ?, ?
1, ?, ? , ?
?, ?, ?, ?
?, ?, ?, ?
Next step is to put position (0, 1) and (1, 0) to the queue, and continue to apply BFS algorithm.
Check (0, 1), there are three directions, go left or right or down. Go right, no cost. Go left, cost 1, but cost(0,0) = 0, new path is bigger than 0. Ignore.
Cost matrix is the following:
0, 0, 0, ?
1, 1, ?, ?
?, ?, ?, ?
Skip rest of steps.

What if the above step to put neighbor nodes of (0,0) down first, right next, (1,0) and (0, 1).
(1, 0) has two directions to go, either go right or go down, so the cost of matrix is updated.
0, 0, ?, ?
1, 2, ?, ?
1, ?, ?, ?
?, ?, ?, ?
(0, 1) has two directions to go, eith go right or go down, so the cost of matrix (1, 1) is 1 < 2, so the minimum cost 1 should replace 2, which is the path from (0, 0) to go down and then go right.

I think that it is important to go over a simple test case step by step, so next time I can figure out how to solve the problem in onsite interview, like Google onsite.

Here are lessons I learn from this practice:

  1. BFS algorithm - the order of neighbor nodes into the queue should not matter in final result. Shortest cost path may not be found first, so it is important to update cost when a new path is found with minimum cost.
  2. It is a graph algorithm. The longer path may have smaller cost.

BFS solution
Declare cost[rows][] array to save minimum cost from (0,0) to (row, col). Apply BFS algorithm, and each step four directions are considered, and then cost will be calculated if the direction is different from the one given in grid[][].

The challenge idea is to find minimum cost to each node (row, col).

Deep thoughts
Nov. 24, 2020 10;35 PM

I asked the interviewee in my mock interview, and then I thought about more carefully. BFS algorithm will exhaust all possible paths, so that minimum cost will be calculated to reach (rows -1 , columns - 1).

If there are two loops, it should not work. The interviewee wrote the solution and I do believe that it will not exhaust all possible paths and each position will have minimum path from start position (0, 0).

The interviewee wrote the code like this:
while i < len(rows)
while j < len(cols)
i, j = calculate_i_j(grid[i][j])
if i > len ...

public class Solution {
    public int MinCost(int[][] grid)
    {            
        var rows = grid.Length; 
        var columns = grid[0].Length; 
        
	    var cost = new int[rows][];
        for(int row = 0; row < rows; row++)
        {
            cost[row] = new int[columns];
        }

	    for (int row = 0; row < rows; row++)
	    {
		    for (int col = 0; col < columns; col++)
		    {
			    cost[row][col] = int.MaxValue;
		    }
	    }
                
	    cost[0][0] = 0;

	    var queue = new Queue<int[]>();
	    queue.Enqueue(new int[]{0, 0});

        //                              right,    left,      down,      up 
        var directions = new int[,] { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } };
        //  1 -> right, 2 <- left, 3 down, 4 up 
        
	    while (queue.Count > 0)
	    {
		    var node = queue.Dequeue();
            var row = node[0];
            var col = node[1];
            
		    int currentCost = cost[row][col];

		    for (int i = 0; i < directions.GetLength(0); i++)
		    {
			    var nextRow = row + directions[i, 0];
			    var nextCol = col + directions[i, 1];
                
                // grid[x][y] has 4 values 
                //  1 -> right, 2 <- left, 3 down, 4 up 
			    int newCost = currentCost + (grid[row][col] == (i + 1) ? 0 : 1); 

			    if (nextRow >= 0 && nextCol >= 0 && nextRow < rows && nextCol < columns)
			    {
                    // current path is shorter one
				    if (newCost < cost[nextRow][nextCol])
				    {
					    cost[nextRow][nextCol] = newCost;
					    queue.Enqueue(new int[]{nextRow, nextCol});
				    }
			    }
		    }
	    }

	    return cost[rows - 1][columns - 1];
    }
}