Tuesday, December 29, 2020

Leetcode discuss: 416. Partition Equal Subset Sum

 Here is the link. 

Mock interview - C# - Hard to tell - add number more than once - Failed 114/115

Dec. 29, 2020
Introduction
I wrote the solution in Leetcode premium mock interview onsite from Facebook, I could not pass the test case 114/115. But I could not tell what it is wrong.

Failed test case
var test = new int[] { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 24, 24, 24, 24, 24, 24, 24, 24, 28, 28, 28, 28, 28, 28, 28, 28, 32, 32, 32, 32, 32, 32, 32, 32, 36, 36, 36, 36, 36, 36, 36, 36, 40, 40, 40, 40, 40, 40, 40, 40, 44, 44, 44, 44, 44, 44, 44, 44, 48, 48, 48, 48, 48, 48, 48, 48, 52, 52, 52, 52, 52, 52, 52, 52, 56, 56, 56, 56, 56, 56, 56, 56, 60, 60, 60, 60, 60, 60, 60, 60, 64, 64, 64, 64, 64, 64, 64, 64, 68, 68, 68, 68, 68, 68, 68, 68, 72, 72, 72, 72, 72, 72, 72, 72, 76, 76, 76, 76, 76, 76, 76, 76, 80, 80, 80, 80, 80, 80, 80, 80, 84, 84, 84, 84, 84, 84, 84, 84, 88, 88, 88, 88, 88, 88, 88, 88, 92, 92, 92, 92, 92, 92, 92, 92, 96, 96, 96, 96, 96, 96, 96, 96, 97, 99 };

Hard to tell
Every time the number is considered, it is important to avoid the number to be added more than once.

For example, [1, 7, 4, 5],
dp[1] = true, since first number 1 is in the array;
dp[7] = true, since 7 is the second number in the array;
Also dp[8] should be true, since 1 + 7 = 8.
Next it is to work on index = 2, value 4,
dp[5] should be true, since 1 + 4 = 5, but it should not be updated right away.
The for loop in the following code is to iterate from 1 to 8.
Avoid setting dp[5 + 4] = 9.

Let me try to explain what it is wrong in the following statements:

for (int j = 1; j <= prefixSum; j++)
{
	if (dp[j])
    {
        dp[j + current] = true; 
    }
}

The reason to set dp[9] = true is that dp[5] is set true right away, and then dp[5] + 4 = 9, but 4 is counted twice.

The following code has a bug but I could not tell in my mock interview. I spent over 5 minutes to think but failed to come out the idea.

The correct solution
The working solution is here.

The following code has a bug, could not pass online judge. But I like to remind myself to be humble, and will figure out how to avoid the bug quickly.

public class Solution {
     public bool CanPartition(int[] nums) {
            if(nums == null || nums.Length == 0)
                return false; 
        
            var length = nums.Length; 
            var sum = nums.Sum(); 
        
            if(sum % 2 == 1)                
                return false; 
         
            var target = sum / 2; 
        
            var dp = new bool[sum + 1]; // target + 1 optimal
        
            Array.Sort(nums);            

            var prefixSum = 0; 
            for(int i = 0; i < nums.Length; i++)
            {
                var current = nums[i];                

                for (int j = 1; j <= prefixSum; j++)
                {
                    if (dp[j])
                    {
                        dp[j + current] = true; 
                    }
                }

                dp[current] = true;
                
                prefixSum += current;

                if (dp[target])
                    return true; 
            }

            return dp[target];
        }
}

AC stock: Raise more money

 Dec. 29, 2020

Air Canada is raising more money

On December 15, the largest Canadian airline revealed its plan to raise more money with a share offering. With this offering, the struggling airline plans to raise about $850 million to supplement its working capital and other cash needs. It also expects that the money raised with these offerings will help the company improve its cash position and allow it to implement recovery measures in the near future.

Air Canada has already lost nearly $2.8 billion in the first three quarters of 2020. The analysts expect the airline to add another slightly less than $1 billion to its 2020 losses in the fourth quarter.

In its latest press release, the company highlighted it’s burning $14 million to $16 million cash each day on an average in Q4. Previously, during its third-quarter earnings event, it gave a much lower cash burn projection range of $12 million to $14 million per day for the fourth quarter.

These factors clearly reflect how the situation seems to be getting more worrisome for Air Canada.

Case study: Swing trade | INTC Dec 16-21 6 - 12% drop | Microsoft - Cloud - chip | Dec 29 4.9% gains

 Dec. 29, 2020

Introduction

It is the idea for me to look into. I should consider to work on a swing trade, bet on INTC stock under value, purchase 500 shares instead of 5 shares on Dec. 24. How to design a swing trade on INTC stock, why?

INTC stock


84 million shares, price at $49/ share, total transaction is around $4.2 billion US dollars. It is definitely a good place for a retail player to bet on short term return. 


Dec 22, 2020

I purchase 10 shares of INTC stock on Dec. 22, 2020. I should consider INTC is under value. The market is not rational on Microsoft news on cloud solution to manufacture it's own chip. 

I should invest using TFSA account, purchase 500 shares of INTC. 

Yahoo finance


I should consider short term or long term investment. So I should invest 500 shares at price $45.99. 

INTC stock

Take some time to learn undervalued stocks, INTC is the best stock for me to work on as a value investor. 


Expr stock: Yahoo -> finance -> conversation

 Comment: 

 EXPR has 6 months from the Sep notice. They’ve met one of 2 criteria to regain compliance so far. On the last calendar day (Thursday 12/31), they need an average of 1.00+ over 30 trading days and a price over 1.00. They’re looking really good on the first point (average). They just need to close above $1.00 on Thursday and they can regain compliance...early.



Monday, December 28, 2020

Evictions Are Violence: Millions Could Lose Homes Amid COVID Pandemic If Federal Moratorium Expires

 Here is the link. 

Millions across the U.S. could be forced from their homes in the middle of the pandemic if Congress does not extend the federal eviction moratorium that is due to expire at the end of December. Congress is expected to push the moratorium back by one month, to January 31, in the $900 billion stimulus bill being debated in Washington, but such an extension would only be a temporary fix to a much wider problem. The U.S. Census Bureau reports that one-third of U.S. households are behind on rent or mortgage payments and will likely face eviction or foreclosure in the next two months. We speak with UCLA researcher Kathryn Leifheit, who says the lifting of state eviction moratoriums this summer led to 430,000 new COVID infections and 10,000 deaths. "We think these deaths are preventable, and they could have been prevented had those moratoriums been kept in place," says Leifheit. We also speak with tenant rights activist Tara Raghuveer, who says the federal evictions moratorium "wasn't good enough to begin with," but allowing it to expire would leave "millions of families vulnerable to eviction within the first 20 days of the next year." #DemocracyNow Democracy Now! is an independent global news hour that airs on nearly 1,400 TV and radio stations Monday through Friday. Watch our livestream 8-9AM ET: https://democracynow.org Please consider supporting independent media by making a donation to Democracy Now! today: https://democracynow.org/donate

Miami residents priced out of a city built for the rich

 Here is the link. 

Miami is one of the worst cities in the U.S. to live in when it comes to affordable housing, and residents pay among the highest share of their incomes on rent. But a recent plan endorsed by the city would pave the way for creating 12,000 affordable housing units by 2024. Special correspondent Alicia Menendez reports as part of our series, “Chasing the Dream: Poverty and Opportunity in America."


San Francisco turned ghost town? Here's how empty the city really is

 Here is the link. 


Dishwasher: Back to work

 Dec. 28, 2020

Introduction

It is hard for me to figure out how to make it work. I did study how to replace the latches, but the handyman just pushed hard and it is back to work. 

Dish washer 

It is hard for me to handle roaches. I spent hours to work with people and figure out how to get rid of those roaches. Now it is under control. I do not know how I solve the problem with current renter. 


Landlords warn NYC is on the 'brink of catastrophe'

 Here is the link. 

Landlords are often seen as the bad guys, the people you have to pay on time every month. But just like tenants, many of them say they've been struggling to make ends meet during the coronavirus pandemic -- and they believe the city is on the brink of catastrophe. While we've heard from people who have moved from New York City to places across the country, at least temporarily, during the pandemic, 7 On Your Side Investigates spoke with some of the small landlords left behind.

Kitchen pipe: So many issues - How did I survive so many repairs?

 Dec. 28, 2020

Introduction

It is hard for me to survive as a home owner. I only have one home, and I lived there from 1999 to 2010. I have to learn how to survive to go through pandemic as well. 

Kitchen pipe 

I got complaint after the renter moved in less than two weeks. The pipe was broken, and I spent two hours to contact contractors. At least I have to pay over $200 dollars for pipe for the work. 

I always stay calm since I know that housing is most important for people. 

From 1999 to 2020, 21 year old at least pipe - got rotten 





After the repair, 



Why many companies are relocating to South Florida amid Covid-19

 STWD stock 

Here is the link. 


INTC stock: Plan to purchase 100 shares

 Here is the link. 

  • Trading at 46.8% below our estimate of its fair value
  • Earnings have grown 18.7% per year over the past 5 years
  • Pay a reliable dividend of 2.8%
Risk analysis
  1. Earnings are forecast to decline by an average of 3.8% per year for the next 3 years
  2. Has a high level of debt


EXPR stock: Comparison between 5/4/2018 and 12/28/2020

 Here is the link. 

I like to understand what is difference between 2018 and 2020

2018 6.67 USD - Sept 1, 2017

5/4/2018            2,163 (Revenue) Net income 22.06  Expense 801

10/30/2020        1,384 (Revenue) Net income -493.79  Expense 811

2020 Dec 28, 2020 1.02 / share, Dec. 28, 2020


DateRevenueNet Income*G+A ExpensesR&D Expenses
10/30/20201,384.76-493.79811.48-
7/31/20201,551.19-406.54830.91-
5/1/20201,778.2-308.47873.83-
1/31/20202,019.19-164.36910.03
11/1/20192,040.9-23.83570.72-
8/2/20192,067.37-12.76574.71-
5/3/20192,088.26-0.82576.65-
2/1/20192,116.349.63581.91-
11/2/20182,187.638.12812.66-
8/3/20182,176.0636.18804.86-
5/4/20182,163.6622.06801.37

FEYE stock: 58% share price increase - tips

Dec. 28, 2020

Introduction

I spent over two hours to work on equity research, I like to write down what I learn and focus on reading and learning. 

Facts 

  1. FireEye didn't make a profit in the last twelve month;
  2. Expect strong revenue growth - postpone profitability to grow revenue fast - uninspiring
  3. Last three year FireEye grew at 6% annually
  4. Dec 2019 Revenue 889 m/ yr, earning -257 m/ yr

CHS stock: Simple wallstreet

 Here is the link. 

Price to Book ratio

PB vs industry: CHS is good value based on its PB Ratio (0.7x) compared to the US Speciality Retail industry average (2.2x).

PB ratio 

company 0.7x, industry 2.2x, Market 2.1x

Earnings and revenue growth forecasts

Oct. 30, 2020

1.465 b/ yr

Earning -US$285m/ yr

22% -> 30% gains 

I shared CHS went up 22% this morning to wechat investment group, and total gain today is 30%. I am not sure why it went up. 




CHS stock: Yahoo -> Finance -> Conversation

 CHS - 20% gains - 2,831,000 shares

I like to learn from comment. I like to see my thinking process, and make adjustment. 

It is immaterial how many shares I am short. I never worked for Chicos. I see a highly mismanaged company conceal the real problems with their company. I see them profitting from their mistakes and fooling investors. Then I see foolish investors tout the disastrous numbers of a company that is likely going bankrupt. The longs who post are doing an injustice to those should know the truth of a company accumulating debt over $1 Billion. It is a near conspiracy to cover it up. Larry is right, very few people every read numbers of the 10Q and more invest off the comments of the conference call. This would be bad for most investor portfolios.


INTC stock: Yahoo -> Finance -> Conversation

Comment:

Intel is facing a lot of headwinds. The great news for Intel is that Microsoft and Apple make up less than 5% of Intel’s $80 billion per year revenue which has grown the last few years. Does it hurt, sure it hurts. But from a profitability stand point, the deal that Apple and Microsoft have with Intel will be quickly replaced with higher margin customers. Demand in this space is tremendous now and over the next 10 years.
Over the last 2-3 years Intel had increased its fab capacity by 100% and they are running at full capacity and then some.
Intel’s investment in Cloud, AI, and autonomous driving will keep Intel growing revenue and profits.
Intel’s 2020 revenue is expected to be close to $80 Billion with a “B”!!!! Net profit of almost $18-$19 Billion!
To put that in perspective, If you add up AMD’s, Nvidia’s, and Amazon’s net Profit for the year, you get close to Intel’s! Think about that for a moment.
Facts are, you can’t deposit market sentiment in the bank, you can only deposit $$!
In the next 3-5 years, I think investors that bought at these levels will be very happy with their investment. Intel will prove to be a gem in this space that the investors that pay attention to fundamentals will be greatly rewarded




Explained | The Stock Market | FULL EPISODE | Netflix

 Here is the link. 

In partnership with Vox Media Studios and Vox, this enlightening explainer series will take viewers deep inside a wide range of culturally relevant topics, questions, and ideas. Each episode will explore current events and social trends pulled from the zeitgeist, touching topics across politics, science, history and pop culture -- featuring interviews with some of the most authoritative experts in their respective fields. In this episode: Does the stock market accurately reflect the status of the economy? Finance specialists discuss market history, valuations and CEO incentives. US Rating: TV-MA. This show is designed for for mature audiences only.



Sunday, December 27, 2020

DealBook 2016: The Long and Short of Activist Investing

 Here is the link. 

Bill Ackman, C.E.O., Pershing Square Capital Management LP



For sale: The American dream | Fault Lines

 Here is the link. 

The US' housing bubble burst nearly six years ago, but the worst may be yet to come. After a landmark settlement, the major banks have lifted a freeze on foreclosures and government relief has been too small to make a difference. "We are often portrayed as the bad people, like we basically just come in and make all the money from people who are in bad situations. But the fact is, if we don't buy the property then the bank [will] take the property back."

Minimum wage: A life full of difficult choices

 Here is the link. 

One dollar for a meal - usually homeless people, now it is for minimum pay job people. 

Seven days a week / Need a day off - 17 years in a row - basically how much you need

Support family in Cuba - 

Poverty in Canada - 

What am I doing wrong? Feeling normal 

What quality of life can minimum wage workers afford?

 Here is the link. 

$9/ hour on Mcdonalds - 

Have roommates - $550/ month, two of them shares - food stamp 

30 miles away - Shop lifting - high school - stealing clothes - homeless situation - 

Rather work instead of on state assistant

$27/ hour - without public or private help 

Outskirts of ...

$9/ hour - $290/ month housing, $300/ month for food stamp 

No sick pay - 

Hard for them to meet basic needs - they go out working - basic needs - infants/ afford housing, food and other things.

Tax payer - basic needs - 

Complete out of ...

Situation - I am anger - instead of 

Swing trade: It is hardest game to play

 Dec. 27, 2020

Introduction

It is so important for me to stay on algorithm and data structure practice, or system design learning in my spare time. I also thought about a few times to make $1000 dollars/ month by trading on stock market. I could not continue since big rebound was so surprised in Nov. 2020, I did not learn enough how to play uptrend game. 

Swing trade


I do not want to lose my 10 year saving on stock market. But I do like to invest on valuable stocks at reasonable price. 

I like to learn so many business, but it is important for me to be patient, learn what I like to do before I try to do something new. 


The Rise And Fall Of Toms

 Here is the link.

Marketing professor - buy one and give one for people without shoes - hero product.

$48 to $78 pair of shoe - one model too long - stale - easy to copy. 

Sketcher - easy to copy, give away two copies instead of one. 

Outside research team - university of San Francisco - reward student attendants - 2011 - include sunglasses - treatment of cataracts 

2014 - Toms roasting - weeks of clean water - sales struggled, regain control - whole sale - 

Vogue - October 2006 - Direct to consumer - profit margin - slump 

Pivot business model - credit rating - loan for 2020

$35 million investment - big obstacles - so many competition - rockport - bankrupt, payless shoe - 

sustainable business - focus on social responsibility - focus on product 

Brand experience - direct to consumer - Went to retail - department - impact evaluation 

Learning organization - that is the key  - right product - next big thing again. 

Behind On Rent (Official Full-Length Film)

 Here is the link. 

BEHIND ON RENT is a short film by Lincoln filmmaker Gabriella Parsons that shares the stories of housing-insecure Nebraskans and their families amid the COVID-19 pandemic. BEHIND ON RENT highlights the human toll of our burgeoning eviction crisis and features those who are working to protect our most vulnerable neighbors. Eviction is not just a symptom of poverty. It's a cause. Learn more and get involved at SpeakUpLNK.org.

An Eviction Crisis Worsens in Kansas City as 2021 Nears

 Here is the link. 

An eviction crisis existed in Kansas City before the pandemic. The pandemic has made it explode. Between moratoriums, foreclosures, and evictions there are lives at stake and nothing is certain.



Behavior interview: Case study - website crashed in 2020

 Dec. 27, 2020

Introduction

It is toughest project to work on called behavior interview. What I like to look into and what I should think carefully before I have to answer the question. I like to do a small case study on one question. 

Case study

What is difficult project work on? Why it is difficult? What have you done? What have you done differently if  you can?

First and most important, I think that I should choose project in less than six months. And I have to think about what is difficult. 

First I should say that it is website crash. It crashed and a few people noticed that right away, 4:00 PM to 6:00 PM sometime. 

What makes it difficult? 

I stay on the job 10 years. I did not take ASP.NET certification, and I did not finish IIS administration book at all. I have working knowledge but it is not testable. I did not have any crash issue in last three years. I almost assume that the website is a money making machine, I do not need to do a lot of maintenance; Everything goes smoothly.

Certainly it is not too tough for me to solve it in less than two weeks. I just quickly identified the issue to restore the website. And I like to take some extra time to review a lot of things before it is fixed. 

Here is the list of things I worked on:

  1. Event viewer - IIS server - try to see if there is any serve issue
  2. Database - Review cache mechanism, and all product features on this business website
  3. Work with browser - why it is not working, inspect -> I found something interesting -> html code was broken
  4. I did turn off cache for websiteMainMenu table, next day I got complaint that the website was so slow to respond. -> I should make changes no one noticed. 
  5. I quickly fixed the cache issue to restore product feature, and I also found the issue the missing close div issue. 
  6. Lesson learned: I can quickly figure out how things work in less than two weeks, I tried to identify so many possible factors, over 100 of them. I learn to fix them. 
  7. I wish that I can do better and make some update as well. 




What are missing from 2001 to 2020? Close look carefully.

 Dec. 27, 2020

Introduction

It is my small research as an owner as a rental condo in Florida. I have chance to learn from my own experience as a landlord. I like to look into what are missing from 2001 to 2020.



William Ackman: Everything You Need to Know About Finance and Investing in Under an Hour | Big Think

 Here is the link. 

Equity

Debt

13:26

Worry about losing all the money. Do not worry about too much the price goes up or down in short term. 

How to think about risk? Compare to other alternatives. Bond, debt 3 yr or 5 yr provided by government. 

Stomach to hold on volatility - 

Nature tendency to buy when the stock price goes up, and sell when the price goes down. 

Financial secure - money in the bank, do not need those money in 5 years or 10 years. 

A good money manager:

  1. Can easily explain investment strategy
  2. Has a good reputation
  3. Has value approach
  4. Has a successful track record of at least 5 years
  5. Has a consistent approach
  6. Invests own money in the fund





Kitchen project: Range hood, oven, water pipe, dishwasher, roaches

 Dec. 27, 2020

Introduction

It was a tough project to get rid of roaches in Florida rental. I had very good attitude, show my appreciation to have a new renter moving in from silicon valley. 

Range hood

I paid a top level range hood, which should wait discount in Best buy in December. I got it installed before my renter flied from California. 

Broken pipe








Dishwasher

Range oven cleaning 

I got two people two hours to clean the kitchen and oven with $100 dollar cost. 


Roaches

It is most challenge job to get rid of roaches. But it can be done very quickly in less than two weeks. 

Actionable Items

A new glass top range costs $420 in Best Buy, and $29.00 for delivery. The repair will cost more than I expect. 

It takes me $100 dollars to clean the oven and cabinet. There is only one coil working. I need to fix another one. I do not like to waste the resource just to get a new one, which is against my being frugal principle.

I am planning to visit Florida and then fix the range by myself. I need to learn how to quickly diagnose the problem and put one coil in to replace broken one if needed. 

 



CBSN Originals presents "Reverb | Losing Las Vegas"

 Here is the link. 

The economic fallout from COVID-19 hit Las Vegas harder than any other major city in the nation, devastating households far from the famous Strip. Though the lights are flickering on once again, uncertainty still looms. This episode of CBSN Originals reveals how some Las Vegas workers are navigating a tough new reality with no end in sight. CBSN Originals is our premium documentary series that is sure to challenge your views on this and a variety of other issues. See our full series library at http://cbsnews.com/cbsnoriginals.

Bathroom vanity: Tough project - how to make things work?

 Dec. 27, 2020

Introduction

It is easy to remove the door of vanity, it was rotten after five years. I like to talk about this project over $300 dollars. 

Coronavirus and tough time

It is my rental property and I was asked to work on this bathroom vanity. It is tough since I called my last renter the vanity is in stable condition, only front door was rotten, one time the mushroom grew from this piece of door. 

I got the same size new vanity, and I had to pay to get it installed. 

The cash is king. The building needs a new roof which costs more than $100,000 dollars, and I paid $5000 dollars in 2020 for two installments. 







First bathtub project: repaint

 Dec. 27, 2020

Introduction

It is tough to be a good project to maintain a two bedroom condo in Florida. I spent over $4000 dollars in 2015 for bathroom, but it needs another project to work on. 

Repaint

I have to listen to my renter, she asked me to pay the cost to repaint the bathtub. 




ASML stock: One more business - I like it!

 Dec. 27, 2020

Introduction

It is about networking. In USA or Canada, I like to stay open and keep learning. I visited my friend last year when I had Facebook onsite in August 2020. We do not know what will happen in Silicon Valley. I like to write a short story how to connect in USA or in Canada. 

ASML - Nice company

I visited my friend who worked for Johnson and Johnson, and I had chance to walk 200 meters just crossed a street to her company in August 2020. 

She called me this year in May. In November she moved in my rental property in Florida. Life is tough, everyone is got challenged. Almost zero student visas are issues after May 2020. I had to pay roof repair two installments $2500 twice. 

My friend made decision to relocate to Florida and work remotely. Now I know ASML better since part of my rental income comes from ASML. 

IBM 

I did not do very well this year stock investment by myself. My index fund did very well. So my friend - a retired IBM engineer offered me free to install a range hood for me. 

I need to fix a few things to make it work for a senior lead to work inside home. 

Better mindset

I have to learn how to change my mindset quickly, quickly adapt the challenges. 


I have roots in Canada now - after 10 years

 Dec. 27, 2020

Introduction

I took a walk in central park, and then recorded videos for myself to improve my English, get rid of my coronavirus anxiety. I met a friend and her six-year-old daughter. We attended Willingdon church 10 years ago. My topic is that I have roots in Canada now. 

2010 - 2020

It is 10 years. I almost forgot my friend. Now she is technical lead in HSBC. I just could not believe that it is over 10 years ago. At that time, she was not married. I knew a lot of people in the city of Vancouver. 

I like to play with ducks and see birds enjoy the water pond in central park. I just have thick skin, and I like to be frugal and have some creative activities. I recorded a video for myself. 




I spent time to walk around central park in 30 minutes. And I walked to metro town to check how many people did shopping today. I like to figure out if my investment of EXPR stock 2300 share at cost $1.10 will have good return in next year or two. 

Here is my youtube link.