Thursday, October 10, 2019

Case study: Amazon offer package

The link is here
Last Edit: August 23, 2019 10:41 AM
Education: BS In CS
Years of Experience: 0
Prior Experience: 0
For fresh grad, any related Internship/coop experience? 2 month internship experience at Small Govt Contracting Company
Date of the Offer: August 19th 2019
Company: Amazon
Title/Level: SDE1
Location: Seattle
Salary: 108K
Relocation/Signing Bonus: 7K(Relocation) +24K(1st Year) + 20K(2nd Year)
Stock bonus: 70RSU vesting - 5/15/20 (20 every 6 months until fully vested)
Total comp (Salary + Bonus + Stock): ~ 150k
Benefits: Standard
Amazon
Here is the link.
3 rounds total
8 YOE totaly, 6 years in a small company, 2 years in a medium size company.
base 155,000
sign on 79,000 + 60,000
stock 89
on avg about 230k TC
Microsoft
Onphone + Onsite
Onsite has 4 rounds, 45 minutes each.
Only 190k TC, forgot the detail numbers. Decided to go to Amazon.

Microsoft Stack Ranking

Here is the link.

Pioneered by Jack Welch at General Electric in the 1990s and sometimes known as “stack ranking,” this method is fairly common in Silicon Valley and was most notoriously used by Microsoft until the company got rid of it in 2013 after widespread employee complaints.

Stack ranking - 30 minutes study


Stack ranking 

 “员工分级评鉴制度”(stack ranking),在上世纪90年代由世界级管理大师杰克·韦尔奇 (Jack Welch) 发明,通过他的公司通用电气,以及包括 Facebook、微软等在内的美国科技公司发扬光大。

在业绩考核时,工程师们需要在系统里撰写两封信,分别评价自己和经理的表现,并寻求三五同事也为自己评价;紧接着,经理会阅读这些信件,按照工程师在过去六个月内所完成或未能完成的每一项工作,其所造成的影响(Impact),进行逐一量化分级。

最顶级的一级是“重新定义” (Redefine) ,但多位Facebook员工向硅星人透露这个比例能有2%就很不错了;之后则是“极大超过预期”(Greatly exceeds expectations)、“超过预期”(Exceeds)、“完全达到”(Meets all) 等等评价,比例越来越大。

这会导致一个不可避免的情况:在一个组里,尽管大家的 Impact 可能接近,也都很不错,由于比例相对稳定,总会有人不得不被放置到更差的区间里。

而且,尽管考核分级会经过不同级别的人校准,但工程师们的直属Manager (经理)在这个考核体系里有相当大的裁量权。


According to two former executives, the grade breakdown is approximately as follows:
  • “Redefine,” the highest grade, is given to fewer than 5 percent of employees
  • “Greatly exceeds expectations”: 10 percent
  • “Exceeds”: 35 percent
  • “Meets all”: 35 to 40 percent
  • “Meets most,” a low grade that puts future employment at risk, goes to most of the remaining 10 to 15 percent
  • “Meets some” grades are extremely rare and are seen as an indication that you’re probably getting fired, according to multiple employees.
  • “Does not meet” are exceptionally rare, as most employees are fired before they get to that level.





Case study: Facebook E4 package in 2019

Oct. 10, 2019


Introduction


It is my personal finance research. I like to be a millionaire before I turn 60 years old. It is hard for me to get the offer from Facebook, but I made my first onsite in 2019. Now I am trying to work on investment, I am just a learner, try to adapt my research on algorithm and data structure to personal finance. One thing is to study Facebook E4 package in 2019. 


Case study


I think that the package should be real number since the engineer wrote the post and also works for Google. 

Facebook E4
Here is the link.
January 16, 2019 1:15 PM
Education: MS in Computer Science
Years of Experience: 4
Prior Experience: Bloomberg 2 yrs, Apple 2 yrs
Company: Facebook
Title/Level: Software Engineer
Location: New York
Salary: $155,000
Relocation: n/a
Signing Bonus: $75,000
Stock bonus: $300k stock grant vested over 4 years
Bonus: Performance-based bonus up to 20% of salary every year (10% target)
Total comp (Salary + Bonus + Stock): ~$320.5K first year
Benefits: 21 paid vacation days, 401k, health and welfare, free food
Other details: Negotiated once, just increased signining by $25,000
Experience: Offers from Google, Facebook is here.

Offers from Google/Facebook/Apple/Uber/Snap/etc.. after numerous failures

Oct. 10, 2019

Introduction


It is so challenging for me to advance myself in Leetcode weekly contest. If I can push myself to top ranking 5000, then I think that it is easy for me to pass any algorithm and data structure coding interview.

Role model


I came cross this article since I like to study the offer package from Facebook.

Here is the article.

Leetcode contest


I moved from Manhattan to Silicon Valley, and I was so bored! I actually started to solve leetcode problems for fun and started participating leetcode contest whenever I could on Saturday night. The contest time was not the best, but I enjoyed whenever I could participate, and this really improved and prepared me well for the upcoming interviews!

Doing lots of leetcode practice got me prepared to solve algorithm question very quickly and efficiently, and the interview seemed easier than doing the contest. 

Wednesday, October 9, 2019

Taking more risk

Oct. 9, 2019

Introduction


I like to write a blog about taking more risk. How to advance myself to be a rich person, and a millionaire if possible.

How to set up a goal and motivate myself? 


It is the first time I learn that I should work on my goal setting. Even though I may find that it is so hard for me to achieve the goal to be a millionaire, I may learn a few things through the research. I will open a new world for me.

It is so important for me to reach out and fully enjoy my career and my life. What else should I do in terms of building wealth, enjoying life and my career.

I need to work on a few things in order to build wealth, reach a million dollar wealth goal. My idea is to fully develop myself as a career woman, personal investor of USA economy.

Right now, everything looks tough from my side. Three things surprised me, this May I passed Microsoft online code screen, and then this June I passed Amazon online code screen, phone screen; and then I passed Facebook phone screen in July as well.

Business world is totally different, and it is so exciting to meet people in Amazon and Facebook through onsite interview.

I did feel the excitement, I should work hard to advance myself in terms of problem solver. I should figure out better what to work on after those two onsite interviews.

Get motivated


It is such great experience to read this post on leetcode.com, the author shared his experience to get offers from Google and Facebook after numerous failures. Here is the link.


Keep learning personal finance

Oct. 9, 2019

Introduction


It is my concern how to spend time, should I focus on algorithm and data structure practice, or I learn more about personal finance, investment.

A check list 



How to write an excellent post?

Oct. 9, 2019


Introduction


It is the first time I learn that I can write a post and then get 4 upvotes, ranking top 7 in one of hard level algorithm on Leetcode.com. 


Crafting skills


I think that it is not difficult to write an excellent post. The algorithm I studied is so easy to understand, since I put together some comment to make it so straightforward.

And also I did spend time to save a graph from weekly contest lead board, and then wrote down my observation.

It is so important for me to learn how to document good learning process for other players.

Being a good mentor, helper, or player, I strive to document my practice, my learning, and then I have chance to meet more people in the world. I do believe that it takes so much time for me to learn and master one algorithm. I also certainly like to see people advance skills quickly, since they learn from my experience through my post or blog. I always like to be one of players, share and learn, learn and then share.

Here is the link.



Case study: hard level algorithm my post ranks top 7

Oct. 9, 2019

Introduction


It is the time for me to review my achievements. I did not get really big progress in terms of problem solving in 2019. I did get back into stock market, and put my 401 K and IRA back into stock market this April, and I went to onsite interview from Fortinet in May, and then prepared onsite for Amazon and Facebook in August, I had phone screen from Docusign in September. I learn slowly to adapt the challenge to advance myself. Today I like to talk about something new, my post ranks top 7 - a hard level algorithm.

Case study


I did not notice that I wrote a post, since I did not add it to my github repository Leetcode page six month ago.

Here is the image to show my ranking.


Here is the link.

How to write an excellent post?


I think that it is not difficult to write an excellent post. The algorithm I studied is so easy to understand, since I put together some comment to make it so straightforward.

And also I did spend time to save a graph from weekly contest lead board, and then wrote down my observation.

It is so important for me to learn how to document good learning process for other players.

Being a good mentor, helper, or player, I strive to document my practice, my learning, and then I have chance to meet more people in the world. I do believe that it takes so much time for me to learn and master one algorithm. I also certainly like to see people advance skills quickly. I always like to be one of players, share and learn, learn and then share.






US blacklists China's biggest unicorns

Here is the link.


1049. Last Stone Weight II

Oct. 9, 2019

Introduction


It is my second practice. I like to write one more idea and also look into the issues, what I should learn from the code.

Case study


Here is the post.

Oct. 9, 2019
It is a good idea to learn to write more than one solution. What I did is to study the most popular post in the discussion post, and then I wrote one C# solution.
It is important to read the case study I prepare first, and then it will be much easy to follow the design of the solution.
Case study
Given the array with values [31, 26, 33, 21, 40], the sum of the array is 151, let us denote it as Sum. Sum/ 2 will be 75. We can divide into two sets, [33, 40] and [31, 26, 21], the sum of first array is 73, and the sum of second array is 78, the minimum difference is 5.
But if we update the loop from ascending (this is descending, (for (int i = Math.Min(1500, prefixSum); i >= item; i--)), one number may be used more than once, so that minimum difference can be one. Since [26, 26, 23] can be an array, but 26 is counted twice, the sum of the array is 75, so 151 - 2 * 75 = 1.
The challenges
  1. How to design the solution so that each stone will be at most counted once to the sum?
  2. Argue to yourself, why order does not matter? We can count each stone at most once in any sum, but which goes first does not matter.
Here are highlights:
  1. Understand how to convert the problem to classical Knapsack problem to divide array into two sets;
  2. Understand how to find all possible sum using all stones available, make sure that one stone can only be used at most once for each sum;
  3. Most challenging problem is to design the search using descending order. Detail see my first practice if you have questions. Here is the post.
  4. Go over a test case and learn the case study before working on the solution.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1049_last_stone_weight_II___lee215
{
    class Program
    {
        static void Main(string[] args)
        {
        }

        /// <summary>
        /// Oct. 9, 2019
        /// study code
        /// https://leetcode.com/problems/last-stone-weight-ii/discuss/294888/JavaC%2B%2BPython-Easy-Knapsacks-DP
        /// 
        /// The idea is to implement the solution using time complexity O(NS), N is length of the array, S is the sum of the array. 
        /// space complexity is O(S), where S = sum of the array stones. 
        /// </summary>
        /// <param name="stones"></param>
        /// <returns></returns>
        public static int LastStoneWeightII(int[] stones)
        {
            // length <= 30, value of stones [1, 100]
            var dp = new bool[1501];

            dp[0] = true;
            var sum = stones.Sum();

            var prefixSum = 0; 

            foreach (var item in stones)
            {
                prefixSum += item;
                for (int i = Math.Min(1500, prefixSum); i >= item; i--)
                {
                    dp[i] |= dp[i - item];
                }
            }

            for(int i = sum/2; i > 0; i--)
            {
                if(dp[i])
                {
                    return sum - i * 2; 
                }
            }

            return 0; 
        }
    }
}


1049. Last Stone Weight II

Oct. 9, 2019

Introduction


It is the algorithm for me to practice dynamic programming, and also it can be converted into classical algorithm called Knapsack algorithm. I had to spend extra few hours to study and then figure out the solution with more detail.


Case study


I added one more case study, and then look into challenge to prevent one stone to be counted more than once in any sum.

Here is my post.

Oct. 8, 2019 9:11 PM
It is the first submission I made by studying one of solutions written in Chinese. I still have several concerns in terms of implementation.
In order to fully understand the algorithm, I asked myself why the second for loop is looping from sum/2 to current variable value, can we do increasing order from current variable value to sum/2 instead. I changed the code, and then one of test cases fails.
I need to look into and be able to explain the above failed test case to change for loop from decreasing order to increasing order. I need to ask a few questions, and work on basics first.
I will come back and update the post based on better understanding of the algorithm.
Follow up on Oct. 9, 2019
I have to answer two questions in my knapsack solution, and argue that why my approach is correct.
Question 1:
The order does not matter. In my C# code, for (int i = 0; i < length; i++) , any order will work. Why?
Question 2:
In my C# code,for (int j = sum / 2; j >= current; j--), why it has to be in descending order in your for loop? Can we use ascending order from current to sum /2.
I think that if I can answer those two questions, I prove that I have a good understanding of my reasoning. Otherwise I just try to pass online judge, I studied the code but I could not figure out the same day.
My argument to answer the question 2 is that every stone can only be used once. So it has to be in descending order, otherwise one stone may be counted more than once to sum value.
My argument to answer the question 1 is hard to describe. I have to prove it using a generic case, give any sum = s1 + s2 + ... + si, each stone in right hand side will be consider once, and then assuming that 1, 2, ..., i is the order to show in the array, and then s1 will be marked true, next s1 + s2, ..., s1 + s2 + ...+si = sum is marked as true. That is all.
I also asked the question in the most popular discussion post here.
Follow up
Case study
In order to fully understand the algorithm, I asked myself why the second for loop is looping from sum/2 to current variable value, can we do increasing order from current variable value to sum/2 instead. I changed the code, and then one of test cases fails.
for (int j = sum / 2; j >= current; j--) => for (int j = current; j <= sum / 2; j++)
image
Given the array with values [31, 26, 33, 21, 40], the sum of the array is 151, let us denote it as Sum. Sum/ 2 will be 75. We can divide into two sets, [33, 40] and [31, 26, 21], the sum of first array is 73, and the sum of second array is 78, the minimum difference is 5.
But if we update the loop from ascending, one number may be used more than once, so that minimum difference can be one. Since [26, 26, 23] can be an array, but 26 is counted twice, the sum of the array is 75, so 151 - 2 * 75 = 1.
The following code passes online judge.
public class Solution {
    /// <summary>
        /// study code
        /// https://www.acwing.com/solution/LeetCode/content/2139/
        /// I like to read comment written in Chinese. I like to write good comment like this 
        /// as well one day. 
        /// (动态规划) O(n×sum)
        /// 合并的过程就是给每个重量前赋值正号或者负号的过程,相当于把这些石头分为两组,
        /// 使得两组的差值尽可能小,所以这是经典的集合划分NP完全问题,可以采用动态规划的方法求解。
        /// 设状态 f(i) 表示是否存在一个划分,使得某组的重量综合为 ii。
        /// 初始时 f(0)=true,其余为 false。
        /// 转移时,模仿01背包的算法,对于每个物品,有放和不放两种决策,故 
        /// f(j)=f(j)|f(j−stones[j])。
        /// 最终答案需要枚举,j 从 sum/2 开始到 0,如果 f(j)==true,则返回 sum−j−j。
        /// 时间复杂度
        /// 状态数为 O(n×sum),转移数为常数,故时间复杂度为 O(n×sum)。
        /// 空间复杂度
        /// 需要额外 O(n) 的空间构造堆。
        /// </summary>
        /// <param name="stones"></param>
        /// <returns></returns>
        public int LastStoneWeightII(int[] stones)
        {
            var length = stones.Length;
            var sum = stones.Sum();

            var found = new bool[sum + 1];
            found[0] = true;

            // transition formula - figure out the reasoning later
            for (int i = 0; i < length; i++)
            {
                var current = stones[i];
                for (int j = sum / 2; j >= current; j--)
                {
                    found[j] = found[j] | found[j - current];
                }
            }

            // Find maximum sum less and equal to sum/2. 
            for (int i = sum / 2; i >= 0; i--)
            {
                if (found[i])
                {
                    return sum - i - i; 
                }
            }

            return sum; 
        }
}


Tuesday, October 8, 2019

1012 Numbers with repeated digits

Oct. 8, 2019


Introduction


It is so surprise for me to read my own post over six months ago. There is a notification since one comment was added recently. I lost track on this algorithm on my github Leetcode repository page. 


One algorithm with 4 upvotes


I was so surprised to learn that I got 4 upvotes on this algorithm. It is such good learning experience for me to learn to write a good post. I like to write the solution again when I have 10 - 15 minutes break. 

March 21, 2019
1012. Numbers With Repeated Digits C# Study code from ranking No. 1 in weekly contest 128 (4 upvotes up to Oct. 8, 2019)
1012. Numbers With Repeated Digits C# standard depth first search with back tracking (1 upvotes up to Oct. 8, 2019)



Ranking board of discussion post



Here is the ranking based on number of upvote. It is a hard level algorithm. I wrote a post and then explained the top ranking weekly contest 128 No. 1, how his solution works and I wrote a C# solution with explanaton. Life is so interesting, I totally forgot what I did until some one left a comment on Oct. 8, 2019. 



Bill Nygren: 'A Stock That Doesn't Look Cheap on the Surface Might Be One of the Cheapest'

Here is the article.


1049 Last stone weight II - series 5 of 5

1049 Last stone weight II - series 4 of 5

1049 Last stone weight II - series 3 of 5

1049 Last stone weight II - series 2 of 5

1049 Last stone weight II - series 1 of 5

I like to look into classical algorithm called Knapsack algorithm. I like to work on a few easy level algorithms first, and then move on medium level algorithms.

I like to choose the post with most votes for me to study and then write a C# solution as well. Here is the link.


Bill Nygren: "Value Investing Principles and Approach" | Talks at Google

Here is the link.

William C. Nygren, CFA: Partner, Portfolio Manager and Chief Investment Officer - U.S. Equities Bill Nygren has been a manager of the Oakmark Select Fund (OAKLX) since 1996, Oakmark Fund (OAKMX) since 2000 and the Oakmark Global Select Fund (OAKWX) since 2006. He is also the Chief Investment Officer for U.S. Equities at Harris Associates, which he joined in 1983; he served as the firm’s Director of Research from 1990 to 1998. Mr. Nygren has received many accolades during his investment career, including being named Morningstar's Domestic Stock Manager of the Year for 2001. He holds an M.S. in Finance from the University of Wisconsin's Applied Security Analysis Program (1981) and a B.S. in Accounting from the University of Minnesota (1980).

Last stone weight II

I like to study one solution written in the blog, I will write a C# solution based on the idea.


Rochon – The Keys To Successful Equity Investments

Here is the article.

1) Consider stocks as fractional ownership in real businesses
2) Being present
3) Profit from market fluctuations rather than suffer from them
4) Leaving yourself a margin of safety
5) Stay within your circle of competence
6) Know when to sell
7) Learn from your mistakes
8) A constructive attitude



5) Stay within your circle of competence
To wander outside of your circle of competence significantly increases your probably of making a poor decision.  In the market, to realize better returns than others, you must have better knowledge regarding the value of the businesses in which you invest (the others are the market).

To succeed, it is important to stay close to companies that one can understand well and evaluate well."