Sunday, October 4, 2020

Intc stock: Intel Stock Is a Tremendous Value at $50

 Here is the article. 

To be fair, Intel did receive a benefit from the corporate tax cut. That’s very real in the sense that it gives the company more profits with which to pay dividends and buy back stock, however it doesn’t reflect improvement in the structural quality of the business.

That said, earnings are up more than 150%; obviously that’s not just tax cuts. Since 2016, Intel’s revenues are up from $59 billion to $72 billion. That’s healthy growth. And management’s pre-Covid guidance saw this climbing to $85 billion annually over the next few years. The idea that Intel is totally stalled out simply isn’t accurate. What’s true is that the CPU business has minimal growth prospects.

However, Intel has diversified well-beyond its most famous operations. Going forward, automotive chips and services (the old Mobileye business) along with nonvolatile memory, programmable solutions, and more can add large chunks of incremental revenue for Intel stock.

Oil stock: Most U.S. Oil Jobs Lost in Pandemic Won’t Return at These Prices

 Here is the article. 

107,000 jobs eliminated 

The collapse in oil demand and prices spurred the fastest rate of oil- and chemical-industry layoffs in history, with about 107,000 jobs eliminated between March and August, Deloitte said in a study scheduled to be released Monday. The number is probably even higher when furloughs and other headcount measures are taken into account, according to Duane Dickson, vice chairman and U.S. oil, gas and chemicals leader for Deloitte.


Deloitte is forecasting a 30% recovery of lost jobs by the end of 2021, assuming oil averages about $45 a barrel and natural gas hovers around $2.50 per million British thermal units. But if crude instead lingers around $35 and gas is more like $2, the jobs-recovery rate probably will only reach 3%, according to the report.

Oil, gas and chemical jobs have become more sensitive to changes in commodity prices as the North American shale revolution turned world energy markets topsy-turvy. A $1 change in oil prices affects about 3,000 oil and gas jobs, double the impact it would have had during the 1990s, according to the report.

Algorithm interview: Find one valid string to remove minimum number of invalid parentheses from a string

 Oct. 4, 2020

Introduction

It is one hour mock interview as an interviewee. I had chance to learn from my own experience, and the interview gave me such great help to analyze time complexity, and I had chance to review my own performance as well. 

Case study of mock interview

Here is the link. 



Interviewee feedback



Interviewer feedback





System design: AWS cloud

 Oct. 4, 2020

Introduction

It is amazing for me to start to practice on pramp.com. I had a system design interview with a peer, and I felt that new generation of software engineers are more hard working and also full of energy. I like to learn from them, and system design is such great learning tool for me to catch up with others. 

Design twitter

Here is my peer's performance. 



My behavior research: My tough finance situation last 10 years

 Oct. 4, 2020

Introduction

It is not easy for me to figure out how to be a good business person to survive in Canada economy. I like to write blogs about this topic. 

My behavior problems

I have some behavior problems. I like to write a series of blogs to look into this issue. How to be a frugal person? How to survive in this economy since coronavirus? How to take care of my own business, and do not fall into traps with others. 

Recently I reviewed my finance problems, and I chose not to talk about my tough situation since coronavirus, hay fever, challenges in my current job etc. 

I choose not to open communication to my siblings. I do believe that hard working will pay off. I choose to be a software programmer, it is not guaranteed and risky job. It is not a job with union, and it is not a stable job like working for government. 

I have to continue to study and work on my algorithm and data structure in order for me to survive. 


Leetcode discuss: 862. Shortest Subarray with Sum at Least K

 Here is the link. 

C# A few steps to solve a hard level algorithm

Oct. 3, 2020
862. Shortest Subarray with Sum at Least K

Introduction
It is important for me to move my focus from easy and medium level algorithm to hard level ones, since I already solved over 500 algorithms and it takes me over 5 years now. I have to start to work on one by one next four weeks to prepare Google phone screen in early November.

Worked on by myself first
I thought about preprocess the array using O(N) time first, so using prefix sum of the array it will take O(1) to calculate any subarray's sum.
In order for me to consider the shortest subarray at least K value, I have to look up previous index value and it's prefix sum. How to find shortest one if there are multiple ones?

What data structure can help to solve the problem? I did not come out the idea using deque data structure, if there are more than one to satisfy at last K value requirement, then the first one in the deque is shortest one for current index - assuming that iteration from start index 0 to last step of prefix array.

In other words, deque will have only one to satify at least K value requirement. And also the first one in the deque should be the candidate.

And also I need to filter out some index which will not be candidate for the start point of subarray to fit into K value requirement, which can be related to deque.

Quick study of discussion post and Leetcode solution
I came cross the solution, and I learn from the reasoning. Here is the link.

I also read the discussion post, but I understand that I will not really learn the algorithm until I can write the code with C# implementation, bug-free, work on a few case study.

C# implementation
I practiced the code and wrote one based on the discussion post here.

Here are highlights of my practice:

  1. Design prefix sum array using length + 1 instead of length of the orginal array;
  2. More on step 1, I failed the test case [2, -1, 2], so prefix array definition is changed to prefix[i] = sum of the array from 0 to i - 1, i is from 0 to length + 1;
  3. I missed deque.Add(i) in my first writing, always go through manual checking - deque, four operations, remove-first, append_back, remove_back, insertion at the back and removal from both end;
  4. Go through prefix sum array one by one, remove from end of deque if the last one will no longer be start of shortest subarray with at least K requirement; Remember a while loop, not once only using if.
  5. Remove start of deque to make sure that if there are more than ones to satisfy at least K value, the first one in deque is shortest one.

Tips to share
Since I spent whole day to learn this algorithm, and also I asked the algorithm in my 10:00 PM mock interview, I like to write down as many tips as I can. So it is easy for me to review the algorithm later.

Work on case study, the array is [2, -1, 2], K = 3, the shortest length is 3. Work on the case and calculate by hand.
Work on case study, the array is [3, -2, 5], K = 4, the shortest length is 1, the subarray is [5].

Segment tree, range sum query is over-engineering for problem solving. I worked on segment tree algorithm, and I asked one question for code review on stackexchange, the algorithm is called kindergarten adventures.

Binary search algorithm based on length of subarray does not work. The interviewee went through the length of binary search, but [3, -2, 5], k = 4, the length = 1, subarray [5]'s sum >= 4, length = 2, non of subarray works, length = 3, [3, -2, 5] with sum = 6 working.

Deque can be implemented using C# LinkedList. Prefix sum array design is hard to work out best design in the first practice.

public class Solution {
    public int ShortestSubarray(int[] A, int K) {
        if(A == null || A.Length == 0)
            return -1; 
        
        var length = A.Length;
        var prefix = new int[length + 1]; // change from length to length + 1 since failed [2, -1, 2]
        
        // using O(N) time to build a prefix sum of the array
        prefix[0] = 0;
        for(int i = 0; i < length; i++)
        {
            prefix[i + 1] = prefix[i] + A[i]; 
        }
        
        var shortest =  length + 1; 
        
        // store index of the array into deque
        var deque = new LinkedList<int>(); 
        
        // three operations of deque
        // remove_front - it is impossible for the start point
        // append_back - it is possible for new start point
        // remove_back - it is impossible for the start point
        
        // check current index and first one in dequeue - prefix difference vs K
        // test case: [2, -1, 2]
        for(int i = 0; i < prefix.Length; i++)
        {
            var current = prefix[i];
            
            // while loop - continuously remove_back
            while(deque.Count > 1 && prefix[deque.Last.Value] >= current)
            {
                deque.RemoveLast();
            }
            
            // missing LinkedList Add?
            deque.AddLast(i);
            
            // remove_front - keep maximum one
            // if start point to current index's difference is at least K, 
            // then start point should be biggest index
            while(deque.Count > 1 && (current - prefix[deque.First.Next.Value] >= K))
            {
                deque.RemoveFirst();           
            }
            
            if( i > 0 && (current - prefix[deque.First.Value] >= K))      
            {
                shortest = Math.Min(shortest, i - deque.First.Value);       
            }
        }
                  
        return shortest == length + 1? -1 : shortest;           
    }
}


Saturday, October 3, 2020

Trello project: Interviewing.io and pramp mock interviews

 Oct. 3, 2020

Introduction

Life is tough as a business woman. I have to make a living and think about how to build wealth. I spent over three months to learn how to invest on stock market. But once I started to work on Google phone screen, next four weeks are most important time for me to learn and work on algorithm, system design and behavior interview preparation. 

Trello project app

I missed 8:00 PM mock interview on pramp.com. It is the first time I set up behavior interview. So I decided to use trello to manage my weekend schedule. 



800 algorithms: Google tagged

 Here is the page. 


Hard level: 862. Shortest Subarray with Sum at Least K

Here is the link. 

Approach 1: Sliding Window

Intuition

We can rephrase this as a problem about the prefix sums of A. Let P[i] = A[0] + A[1] + ... + A[i-1]. We want the smallest y-x such that y > x and P[y] - P[x] >= K.

Motivated by that equation, let opt(y) be the largest x such that P[x] <= P[y] - K. We need two key observations:

  • If x1 < x2 and P[x2] <= P[x1], then opt(y) can never be x1, as if P[x1] <= P[y] - K, then P[x2] <= P[x1] <= P[y] - K but y - x2 is smaller. This implies that our candidates x for opt(y) will have increasing values of P[x].

  • If opt(y1) = x, then we do not need to consider this x again. For if we find some y2 > y1 with opt(y2) = x, then it represents an answer of y2 - x which is worse (larger) than y1 - x.

Algorithm

Maintain a "monoqueue" of indices of P: a deque of indices x_0, x_1, ... such that P[x_0], P[x_1], ... is increasing.

When adding a new index y, we'll pop x_i from the end of the deque so that P[x_0], P[x_1], ..., P[y] will be increasing.

If P[y] >= P[x_0] + K, then (as previously described), we don't need to consider this x_0 again, and we can pop it from the front of the deque.


Pramp.com system design: pastebin

 Here is the link. 



SU.TO: Time to get back in stock market to build Suncor stock positions

 Oct. 3, 2020

Introduction

It is so hard for me to discipline myself as an investor, stay consistent. I like to write down my analysis and thought process. 

My purchase and my loss starting from August 31


Here is youtube link. 

I recorded my thought process in youtube video first, recorded using video app called powerDirector. 

I got dividend on Oct. 2, 2020 through mint.app, around $120 dollar dividend on Sept. 2, 2020. It also reminded me to get back in the position of Suncor energy stock. 

I have to plan how to time the market and get back in the stock market on Suncor stock, should I purchase 500 shares once, or I should break into three sessions, each time I purchase around 150 shares. 

I need to think about long term. For example, if I consider for 4 years return, what is good time to invest on Suncor stock. Since I drive old used car, if I purchase a new car around $12,000 dollars, then I can pay it off in 4 years. I can relate to the new car case, then I can think about how to invest those and get some return. 

On Oct. 2, 2020, Suncor stock price went down the level of March 27, 2020, below $16.00 dollars, the price range is from $15.01 to $15.99 dollars. I do believe that I should get back in 200 shares a time, and invest a few times to catch lowest price. 

Follow up 

Oct. 8, 2020

On Oct. 8, 2020, SU.TO stock went up more than 6%, so many oil stocks went up over 5% as well. I did not purchase any shares after Oct. 2, 2020. 

I tried to stay away from gambling, and tried to work on Google phone screen. But of course I missed the chance to recover my loss over $7000 oil stock loss from August 31 to Oct. 2. I should take market risk seriously. I have to learn how hard it is to stay put, and hold those shares. 

Nov. 14, 2020

Su.TO went up over 20% last week. I did not catch the rebound. I need to look into the issue, and also stay positive and continue to do good equity research. 

Follow up

Sept. 20, 2023



Google phone screen: From Oct. 2 to Nov. 2 four weeks preparation

 Oct. 3, 2020

Introduction

It is hard for me to get invited again for Google phone screen. I went to Google union lake Grace Hopper's event in Oct. 2019, and I had a phone screen in 2017 but I could not clear. It is so surprising that I got invited and the recruiter talked to me over 40 minutes about application process. 

My plan

I have to stop working on trading on stock market, and go back to algorithm practice and design design. 

Based on my experience this May to August for two months Facebook phone screen, and two weeks for system design, I have to make plans early. Start to work on system design early, and work on algorithm practice more, and push myself hard to master a lot of algorithms - specially hard level algorithms this time. 

I failed my senior level Microsoft Vancouver phone screen as well. I was able to pass Facebook phone screen, and got invited for virtual onsite. 

What is a good plan? 

I have to work on my behavior problems and also technical strength issues as well. It is so busy to work on a full time job. I have so many decisions to make, cut this project and that project, since I have to learn how to take tradeoff, and then prevent big defects, and then leave improvements for future - after coronavirus special challenge settled. 

I have to learn how to be a good learner. As one person team to work on design, code and maintenance, I do have so many weaknesses to work on. 

Coding plan

I need to work on coding plan, and also have chance to review my past 500 algorithms practice as well. As a C# programmer, I have to learn from other C# programmers on Leetcode discuss, make sure that I understand how C# can be used to solve all those problems, introduce a lot of hard algorithms on Leetcode first time to myself. 

Rush to review and code

I certainly think that coding is most challenge part for Google phone screen and onsite. I have to push myself to be able to pass Google phone screen. 

The most challenge part is to come out optimal ideas to solve those easy, medium and hard level algorithms first. 

Get back to normal programmer life

I also have to push myself to go back to normal programmer life. In order for me to do that, I booked pramp.com system design interviews, 8:00 AM, 10:00 AM, 12 PM, and 10:00 PM behavior interview as well. 

I have to push myself to stay on track to meet people, help and learn from those peer interviews. 

More will come 

I will come out more ideas how to do the work. I will record a youtube video on this blog topic as well. 

Here is youtube.com link. 


AWS re:Invent 2018 – Building for Durability in Amazon S3 and Glacier with Mai-Lan Tomsen Bukovec

 Here is the link. 


Mai-Lan Tomsen Bukovec: Microsoft Women Worth Watching

 Here is the link. 

Written in 2010 - one of 10 woman in Microsoft and other businesses

Today’s Microsoft Woman Worth Watching: Mai-Lan Tomsen Bukovec

Title: Product Unit Manager for Internet Information Services (IIS)

What’s Your Typical Day Like? She runs a team of 50 engineers who work across test, development and program management. Tomsen Bukovec's day is a mix of meetings about products and meetings about and with people. Somewhere in the day, she tries to get 30 minutes a day outside, where she can often be founding jumping rope in a hidden corner (or indoors in a parking garage when it's horrible outside) with her headphones on, she says. She finds time at the end of every day to reconnect with her husband and three young boys, she adds.