Monday, November 30, 2020

Google's 10 design principles via Laszlo Bock

 Here is the link. 

  1. Focus on people
  2. Every millisecond counts
  3. Simplicity is powerful
  4. Engage beginners and attract experts
  5. Dare to innovate

Google interview preparation: Ten things we know to be true

 Here is the article. 

My notes from the following 10 things: 

  1. Placement in search is not distracting - talk about my experience with sales manager
  2. Search problems - focus on exclusively on solving search problem
  3. Web browser, search results - fraction of a second

We first wrote these “10 things” when Google was just a few years old. From time to time we revisit this list to see if it still holds true. We hope it does—and you can hold us to that.

1. Focus on the user and all else will follow.

Since the beginning, we’ve focused on providing the best user experience possible. Whether we’re designing a new Internet browser or a new tweak to the look of the homepage, we take great care to ensure that they will ultimately serve you, rather than our own internal goal or bottom line. Our homepage interface is clear and simple, and pages load instantly. Placement in search results is never sold to anyone, and advertising is not only clearly marked as such, it offers relevant content and is not distracting. And when we build new tools and applications, we believe they should work so well you don’t have to consider how they might have been designed differently.

2. It’s best to do one thing really, really well.

We do search. With one of the world’s largest research groups focused exclusively on solving search problems, we know what we do well, and how we could do it better. Through continued iteration on difficult problems, we’ve been able to solve complex issues and provide continuous improvements to a service that already makes finding information a fast and seamless experience for millions of people. Our dedication to improving search helps us apply what we’ve learned to new products, like Gmail and Google Maps. Our hope is to bring the power of search to previously unexplored areas, and to help people access and use even more of the ever-expanding information in their lives.

3. Fast is better than slow.

We know your time is valuable, so when you’re seeking an answer on the web you want it right away–and we aim to please. We may be the only people in the world who can say our goal is to have people leave our website as quickly as possible. By shaving excess bits and bytes from our pages and increasing the efficiency of our serving environment, we’ve broken our own speed records many times over, so that the average response time on a search result is a fraction of a second. We keep speed in mind with each new product we release, whether it’s a mobile application or Google Chrome, a browser designed to be fast enough for the modern web. And we continue to work on making it all go even faster.

4. Democracy on the web works.

Google search works because it relies on the millions of individuals posting links on websites to help determine which other sites offer content of value. We assess the importance of every web page using more than 200 signals and a variety of techniques, including our patented PageRank™ algorithm, which analyzes which sites have been “voted” to be the best sources of information by other pages across the web. As the web gets bigger, this approach actually improves, as each new site is another point of information and another vote to be counted. In the same vein, we are active in open source software development, where innovation takes place through the collective effort of many programmers.

5. You don’t need to be at your desk to need an answer.

The world is increasingly mobile: people want access to information wherever they are, whenever they need it. We’re pioneering new technologies and offering new solutions for mobile services that help people all over the globe to do any number of tasks on their phone, from checking email and calendar events to watching videos, not to mention the several different ways to access Google search on a phone. In addition, we’re hoping to fuel greater innovation for mobile users everywhere with Android, a free, open source mobile platform. Android brings the openness that shaped the Internet to the mobile world. Not only does Android benefit consumers, who have more choice and innovative new mobile experiences, but it opens up revenue opportunities for carriers, manufacturers and developers.

6. You can make money without doing evil.

Google is a business. The revenue we generate is derived from offering search technology to companies and from the sale of advertising displayed on our site and on other sites across the web. Hundreds of thousands of advertisers worldwide use AdWords to promote their products; hundreds of thousands of publishers take advantage of our AdSense program to deliver ads relevant to their site content. To ensure that we’re ultimately serving all our users (whether they are advertisers or not), we have a set of guiding principles for our advertising programs and practices:

  • We don’t allow ads to be displayed on our results pages unless they are relevant where they are shown. And we firmly believe that ads can provide useful information if, and only if, they are relevant to what you wish to find–so it’s possible that certain searches won’t lead to any ads at all.

  • We believe that advertising can be effective without being flashy. We don’t accept pop–up advertising, which interferes with your ability to see the content you’ve requested. We’ve found that text ads that are relevant to the person reading them draw much higher clickthrough rates than ads appearing randomly. Any advertiser, whether small or large, can take advantage of this highly targeted medium.

  • Advertising on Google is always clearly identified as a “Sponsored Link,” so it does not compromise the integrity of our search results. We never manipulate rankings to put our partners higher in our search results and no one can buy better PageRank. Our users trust our objectivity and no short-term gain could ever justify breaching that trust.

7. There’s always more information out there.

Once we’d indexed more of the HTML pages on the Internet than any other search service, our engineers turned their attention to information that was not as readily accessible. Sometimes it was just a matter of integrating new databases into search, such as adding a phone number and address lookup and a business directory. Other efforts required a bit more creativity, like adding the ability to search news archives, patents, academic journals, billions of images and millions of books. And our researchers continue looking into ways to bring all the world’s information to people seeking answers.

8. The need for information crosses all borders.

Our company was founded in California, but our mission is to facilitate access to information for the entire world, and in every language. To that end, we have offices in more than 60 countries, maintain more than 180 Internet domains, and serve more than half of our results to people living outside the United States. We offer Google’s search interface in more than 130 languages, offer people the ability to restrict results to content written in their own language, and aim to provide the rest of our applications and products in as many languages and accessible formats as possible. Using our translation tools, people can discover content written on the other side of the world in languages they don’t speak. With these tools and the help of volunteer translators, we have been able to greatly improve both the variety and quality of services we can offer in even the most far–flung corners of the globe.

9. You can be serious without a suit.

Our founders built Google around the idea that work should be challenging, and the challenge should be fun. We believe that great, creative things are more likely to happen with the right company culture–and that doesn’t just mean lava lamps and rubber balls. There is an emphasis on team achievements and pride in individual accomplishments that contribute to our overall success. We put great stock in our employees–energetic, passionate people from diverse backgrounds with creative approaches to work, play and life. Our atmosphere may be casual, but as new ideas emerge in a café line, at a team meeting or at the gym, they are traded, tested and put into practice with dizzying speed–and they may be the launch pad for a new project destined for worldwide use.

10. Great just isn’t good enough.

We see being great at something as a starting point, not an endpoint. We set ourselves goals we know we can’t reach yet, because we know that by stretching to meet them we can get further than we expected. Through innovation and iteration, we aim to take things that work well and improve upon them in unexpected ways. For example, when one of our engineers saw that search worked well for properly spelled words, he wondered about how it handled typos. That led him to create an intuitive and more helpful spell checker.

Even if you don’t know exactly what you’re looking for, finding an answer on the web is our problem, not yours. We try to anticipate needs not yet articulated by our global audience, and meet them with products and services that set new standards. When we launched Gmail, it had more storage space than any email service available. In retrospect offering that seems obvious–but that’s because now we have new standards for email storage. Those are the kinds of changes we seek to make, and we’re always looking for new places where we can make a difference. Ultimately, our constant dissatisfaction with the way things are becomes the driving force behind everything we do.

How Google Thinks About Hiring, Management and Culture

 Here is the link. 

Assess people - training interviewer 

15 minutes - same quality results - train people thinner and thinner


confidence, conscientious, 

Snap judgement - look for data - Separate committee - maintain the quality 

Hiring committee - maintain the quality 

Objective, structure interviews - do not predict performance 

screen hard level - drill down - do not make decision on one person's opinion

Build a website - 2013 - start to work on website - 

Get work done - set goal - manager - we want to make sure that people get work done 

Manage them very well - Forget everything you know - Behavior 

Employee - peer feedback - manager - take away power away from managers 

People can see them customers and feedbacks 

500 engineers - report to one director 

Training people - story in the book - tell them the story how to play golf like Tiger Woods 

HR - consultant - Share group entrepreneurs 

Manage - day one - 50,000 people - how to manage them? 

close the deal and make things happen

Partner, KPCB - beth 

Compensation - pay unfairly 

politics, performance above average - average MBA - system is not fair - performance is observable

different research - software engineers - best people are way better than average 

Difference too big - salary - 20% to 30% 

Best people are way more than that - not 10 times more - absolute - exponential

justify - pay transparent - problems - no one is happy 

procedure justified - change the outcome - appreciated - second thing 

79 cents a dollar - 

Based on your job - not prior pay 

Do not create new one - really wide distributed - market will pay them very well 

Influence - get them in the market - absolute best people and generate most value 

New york times events: Becoming a Googler...and Other Opportunities

 Here is the link. 

Laszlo Bock, senior vice president, people operations at Google, talks about what the world's largest companies look for in an employee, in conversation with Thomas L. Friedman.

I am taking notes while I watch the video:

  • Intellectual learning ability
  • Step in when there is a problem
  • Diversify background
  • Step back
  • Culture fit
  • People just like us - comfortable ambiguity
  • Highly conscientious
  • Not my problem - this is not good
  • Expertise - quite a good engineer
  • Being able to learn, figure out how to do it - 5% or 10% come out something new
  • Nail, hammer - smart creativity
  • 14% no college degree - how they acquire the skills - online training - school - pick up all over the places - skillset - screen candidates - guilty - hiring more people - net hiring 5,000 - 8,000 - 2 million people
  • MIT students - apply everyday - how to manage them?
  • Human being - read the resume - overinvest the recruiters
  • Assess candidates - phone screen - technical coding abilities - cognitive ability
  • GPA - used to require every one - transcript - a candidate - Look good, send me the transcript - people lie - 1% - 4.0 but 2.8, round up, no one rounds down
  • Internal - 360 -> 28 performance factors - how to promote? - citizenship - act like community - 300 independent variables - grades are predicted performance first two years out-of-school
  • Train recruiters, people, curve of college
  • Big mistakes in writing a job resume - trick - interview - two valuable skills in the life
  • To answer the question, led the team and grew the sales, complete x by doing y with number c, using percentage
  • What mistakes - wear a suit - Do not do that - not in Google
  • vulnerable position - show best you can - curious - how this place works - demonstrate authentic interest
  • Something you like, or something you hate
  • Distinguish - authentic - not too many people to do that - authentic
  • Develop resilience - compound interest, credit card interest
  • Google minority hiring - African American -
  • College choice - what is your advice? 18 yrs old,
  • Signals - company recognized, fancy school, widely known, everybody else - send signal sending out
  • Related signals - anything, skillset you get from that, transfer to anything - fundamental
  • Cost/ benefits - quantitative classes
Questions and answers:

1. Employer more good at assessment the people - definition, all are average
2. Push them to take hard level class - quantitative classes; Fund AP classes - enrollment of the classes, affluent and white
3. Talent acquisition - diversity, granddaughter gets a good job - two coolest things -
Build relationship - conscientious - bias - offices all over the world
Most talent people likes to go to USA - non US citizen - quantitative field
Ageism - discrimination - span - 83 year old
Bonus pool - not evidence - unfriendly - uncomfortable - continue to look into closely

30 minutes, well-done! End at 10:36 PM.

Hired&CO: Google Interview and Hiring Process | Questions and Answers

 Here is the link. 


Google - great communication 

All those people are brilliant communicators. 

Top-notch communication as an interviewer. 


General cognitive ability test - 

Think out loud 

- Talk this out loud

- Not having a right answer - how you think about it?

- Think resourcefully, and think quickly. 

- Quick is important! 


Structure interviews - behavior questions and situational

They ask a question -> They go deep -> 

Fail -> how does that impact the team? -> how do you do? Third follows up, be able to respond. 

4. Conscientious and Googleness 

Use we, not I - give credits to people - use I all the time. 


More humble - people being people - Google is more relax culture - more low key, more authentic 

Act like owners, rather than employees. 

Dan Croitor: Interviewing for Googleyness at Google

 Here is the link. 

In this video I explain Google’s 10 Things (Core Values / Leadership Principles) and some insight into Google’s structured hiring process - for the behavioral part in particular. Contains screenshots with examples and advice. It is structured in 4 parts: A. Mission & Ten things we know to be true (Google’s 10 Core Values / Leadership Principles) 1. Focus on the user and all else will follow. 2. It’s best to do one thing really, really well. 3. Fast is better than slow. 4. Democracy on the web works 5. You don’t need to be at your desk to need an answer. 6. You can make money without doing evil. 7. There’s always more information out there. 8. The need for information crosses all borders. 9. You can be serious without a suit. 10. Great just isn’t good enough. B. Two most important things in a recruit, behavioral questions and how to prepare (STAR method) Googleyness. The first thing they measure here is cognitive ability, for example, they’ll ask you: Tell me about a tough problem you solved, how did you solve me, walk me through it. Preparation: 5 stories (full story + shortened into: situation, task, actions, result) + 3 x answers to 20 most common behavioral questions - examples in the video But one more highlight here in terms of leadership - or at least one more interesting keyword - is emergent leadership. I noticed various Google HR leaders referincing it throughout the years; whta does this mean: it’s essentially your ability to step in when there is a peoblem and step out when they are no linger needed. Would be great if you could also make this stand out in one of your prepared stories. C. Supercharge your resume with some tips; Read your CV in 6 seconds. Official advice on structure and more. And last but not least, and this should go without saying, typos in your resume won’t probably disqualify you, but you can be sure they will have a negative impact, so be sure you triple check it and ideally as a friend to review it for you. D. Best way to pass the screening round; hiring process Referrals. Apply through their jobs website. Google’s jobs website is between the very best. Google’s structured hiring is particularly efficient at creating a great applicant experience Sources and interesting reads: The list of behavioral questions shown: Data structure hiring at Google Google’s 10 Things: Google Official Resume advice: Cover Letters examples: Hiring Process (official): 4Cs method from Workit daily: Google AI Principles: FAQ re-apply answered by recruiter on quora: How hiring decisions are made: How to prep the technical interview How to prep for the interview business Google Hiring Process steps quantified, advice Hiring at Google (technical HR): NY Times 2014 Interview with Laszlo Bock about what Google is looking for in new recruits:

Sunday, November 29, 2020

Happygirlzt: LeetCode入门(漫谈常见题型与解法)

 Here is the link. 

I will spend 30 minutes to watch the video Sunday morning. I will do that first thing in the morning. 


  • Two pointers (sliding window)
  • Binary search ( sorted, search space)
  • Combined with Map 
  • Prefix sum ( DP )
  • Quick select (kth ...)


   familiar with some monotonic stack questions

  • Maximum rectangle
  • Next greater elements
  • Trapping rain water - optimal, two pointers



Queue  BFS

Graphs   BFS, DFS, Dijkstra's


  • permutation - all possibilities
  • subsets
  • combination sum
  • partition equal
  • subset sum
  • N-Queen
  • Sudoku

Dynamic programming

  •  total ways
  • True/ False
  • max/ min

  • 0/1 Knapsack
  • perfect squares
  • Coin changes - total ways, minimum
  • climbing stairs 
  • decode ways
  • string related
    • regular expression matching
    • wildcard matching
    • Edit distance
    • LIS / LCS
  • 2D matrix
    • maximum square
    • range sum query
    • bomb enemy
    • unique paths, total ways
  • greedy  Heap (sort)  
    • Top K
    • Campus bikes
    • merge k sorted lists

Google onsite preparation - study material

 Nov. 27, 2020

Google | New Grad L3 [ Pending ]

Helpful Channels by Rank [According to me] :
Back To Back SWE ( Best one for everything )
Abdul Bari ( Very good, when it comes to learning new Data Structures )
WilliamFiset ( Very Good for learning Graph problems )
Kevin Naughton Jr. ( Good for random medium problems. Does not always solve the most effecient way, but it is good enough )
Nick White ( Same as the above )
happygirlzt ( Solves a lot of hard problems. Even if you don't understand her soll, if you watch her code you can figure out yourself )

I just could not believe that because of my age - 54 years old, I just could not believe that I need to refresh those graph algorithm again. I just make excuses for my laziness and so busy, I do not have time to spend learning from the above youtubers. 

I also start to record some videos. I learn that I should be more cheer up and enjoy my life. I have a full time job and have savings, without too much worry. I need to enjoy life and produce good and quality videos for my preparation as well. 

William Fiset: Breadth First Search grid shortest path | Graph Theory

Finding the shortest path on a grid using the Breadth First Search (BFS) algorithm on an unweighted graph. 

Here is the link. 

0:00 Previous Breadth first search video 0:44 Motivation for BFS on a grid 1:36 Converting your grid to an adjacency list/matrix 3:55 Grid vectors 6:09 Dungeon problem 7:51 Breadth first search on grid example 9:12 Using multiple queues for state representation 11:07 Pseudocode 15:56 Recap

William Fiset - Linkedin profile

 Here is the link. 

ACM-ICPC world finalist

honor dateMay 2017

honor descriptionWilliam competed in the ACM-ICPC world finals in May 2017 as part of the Canadian Mount Allison University team. The world finals competition is the equivalent of the Olympics for competitive programming.

Max Flow Ford Fulkerson | Network Flow | Graph Theory

 Here is the link. 

Max Flow Ford-Fulkerson 

0:00 Intro and motivation for maximum flow 2:42 Basics and definitions of network flow concepts 4:26 Augmenting paths, residual edges and the residual graph 8:05 Ford-Fulkerson with DFS example 9:49 Ford-Fulkerson time complexity 11:22 Faster network flow algorithms

Network Flows: Max-Flow Min-Cut Theorem (& Ford-Fulkerson Algorithm)

 Here is the link. 

I like to learn those algorithms quickly again. It is tough job for me to learn how to talk and think in the graph algorithm - Network flows, Max-flow min-cut theorem. 

Flow Networks: Ford–Fulkerson Algorithm: Max-Flow Min-Cut Theorem: Proofs: Reference "Algorithm Design" by Jon Kleinberg and Éva Tardos Chapters 7.1, 7.2 for excellent proofs on all of this.

Things I'd Improve On This Explanation (w/ More Time): 1.) I should have done a walk-through showing how the residual graph dictates how the original graph's edge flows (f(e)) are updated each iteration. (That would've made it more clear how the residual graph in the Ford-Fulkerson algorithm tells us how to update the flow on each edge (f(e)) in the original graph along the s-t path P, THEN we update the residual graph (also along P) to prepare for the next iteration.)

2.) Go into the actual augmentation once we find an s-t path P in the residual graph. We can only modulate the flow f(e) for each edge in the original graph on path P ± the smallest value residual graph edge on path P. The smallest forward edge on path P in the residual graph is the "bottleneck" to how much we can increase flow along the path P in the original graph. (hard to visualize...the textbook may have to take it away with this one, but when you understand this you'll really get it after watching this video)

I also didn't talk about time complexity, but the amount of while loop iterations is bounded to the capacity coming out of start node 's'. We can't ever push more flow from 's' than the sum of capacities of those exiting edges. If each interaction increases the value of the flow v(f) by 1 (and v(f) starts at 0 in the beginning since no "water" is going through the "pipes"), we can do at most C augmentations of the flow network where C = sum(edge capacities leaving 's').

In each while loop: - O(|V| + |E|) to find the augmenting path - O(|E|) to update the flows in the original graph - O(|E|) to update the residual graph

Dijkstra's Algorithm vs Prim's Algorithm

 Here is the link. 

 I like to go over algorithm video from back to back SWE quickly to prepare my Google onsite interview. It is tough job since I stop working on hackerrank contest for a long time, almost over 3 three years. I no longer work on complicated algorithm, and my practice is based on leetcode algorithm. I choose to work on easy and medium level algorithm. All those hard level algorithm, graph algorithm I no longer work on. 

Recently I came cross this dijkstra algorithm in Leetcode weekly contest, one is Google mock interview hard level algorithm - find minimum path in a matrix. 

Saturday, November 28, 2020

Cynthia Carroll - 30 years ago - HBA - my hashtag #googleOnsitePreparation

 Here is the video I watched. 

I chose to publish a video on this evening, and the first time I applied hashtag#googleOnsitePreparation. This is Google brought to me underneath this tag. 

Also I learn that how to make business decision under ambiguity. A very good teaching from professor of Harvard: Tsedal neeley, professor of business administration. 

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 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 → Learn about how Google interviews and hires → Subscribe to Life at Google for more videos →

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 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:

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 


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
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];