Saturday, May 11, 2019

How I pace myself on Leetcode training?

May 11, 2019


Introduction


It is most challenging job to manage myself to practice on Leetcode.com. I like to practice 100 algorithms once I know that I will have chance to be phone screened by Facebook again in May, 2019. One of ideas is to rush to work on another 100 algorithms. But reality is that I practice one more mock interview on Leetcode.com, I came cross the algorithm 236 lowest common ancestor. I learn to pace myself to look up and look down, left and right, I put so many topics in this one algorithm practice. I like to share my learning. 


So many topics Covered


I learned one more solution, and here is the post. 

I solved my first two practice with time out problem applying the idea to find root to p or q path. Here is the solution. 

I like to make a list of things I have practiced on this algorithm:


Recursive
1. Using recursive, learn how to define recursive function, simple and clear.

BFS
I also study the code and write a C# solution using BFS to store all nodes with their parent node. 

Backtracking 
I learn to solve timeout issue in my naive solution in the first practice 2019. 


Also backtrack space complexity is much less compared to my naive approach. 

Post order traversal - bottom up 
How to define a simple and easy recursive function? I learn one solution and like it. 

The solution folder is here. 


Topics 
  1. BFS
  2. child-parent map
  3. Fix naive solution timeout with complicated function
  4. how to build a path from p or q to root
  5. how to build a path from root to p
  6. Naive solution with Timeout and Complicated function
  7. Post order traversal
  8. recursive function - Do not understand
  9. Recursive solution Easy to understand
  10. Recursive solution with backtracking
  11. Timeout challenge

Here is the folder to look up problems and solution based on topics I worked on. 


Bugs are my weakness, so serious!


I also warn myself not to take risk if I am not ready. The bug I came cross on 236 lowest common ancestor reminds me to work on classical algorithm more carefully, focus on learning backtracking, space analysis, and also think about solving algorithms from as many ideas as possible. 

The problem solver is not that I learn how to solve the algorithm in one of ways. The interviewer likes to learn that you can be flexible and be able to handle different solutions and know what to choose and what not to choose. 

Be responsible and be a grown-up. That is the reason I like to take the opportunity as a learning process. Do not take too serious to feel frustrated because of failure. 


It is your duty parable from Bible teaching from Harvard professor

May 11, 2019

Introduction


It is the fear causing the biggest problem in my last 10 year personal finance. I fear the loss of the job, and I fear that I should have financial risk if I take too much debt. I do have to reflect those fears after 9 years in the city of Vancouver. I like to share my learning from Harvard professor.

My learning 


Here is 5 minutes talk in the interview about how to do your duty.

32:00/ 46:51
Parables of talent

Three servants - talent / money

I buried and ...

Value creation chapter - more cost capital/ sit on the things -

Powerful story - we have to make everything we can...

35:00/ 46:51
It is your duty - you have to make most of it.

am I given too much, am I doing enough? You got to do it. You waste the privilege you are doing.

Actionable Items


Value creation chapter - look up Google

Friday, May 10, 2019

Harvard professor is my role model

May 10, 2019

Introduction

It is my personal finance research. I came cross this interview from my favorite interviewer. I watched the interview more than three times, I like to write a blog and relate to 50 years old, how to make a good living in the age of over 50 years old.

Life is tough

I know that time horizon is short for me to make plans. I only have 30 years to plan, I still have no place to live and own somewhere in Canada.

Am I aiming too high target?

May 10, 2019

Introduction


It is 12:05 AM. I like to write a short research blog related to Facebook job application. I believe that I am aiming too high target. I like to write down and try to motivate myself to prepare better, being a better problem solver.


Case study


I do believe that the learning process is so much better after I experienced 2018 June Amazon onsite interview. I know that I have to be open and keep learning. I should not get frustrated and it should be pleasant experience all the time. I have to keep my anxiety level on the check, do not expect too much.

How should I prepare for a three-month preparation project?

Holding grudge - $5000 job for 10 years NYCB - IRA CD

Mission possible: $100,000 job for 10 years (TBRCX)

Mission possible: $100,000 job for 10 years (VTI ETF)

Thursday, May 9, 2019

236 Lowest common ancestor with show case on interviewing.io

May 9, 2019

Introduction


It is the algorithm I have to learn better this time, 2019. What I do is to start to ask the algorithm in mock interview on interviewing.io. I have to learn how to be polite as well. One of ideas is to give the algorithm first, and then follow by "If you feel that it is too difficult in mock interview first 10 minutes, I will move to another algorithm much easy one."

Case study


Here are three steps I follow to quickly figure out:
1. Ask the input, graph, dynamic programming, tree algorithm. Which one should I ask?

Through the answer from the interviewee, I can quickly make a guess how strong he has in terms of confidence.

2. I will be very polite saying that if it is too difficulty in mock interview for first 10 minutes, I will move to another algorithm.

3. Give out Leetcode 236 lowest common ancestor since I like to learn and explore the algorithm.

Today I got a super talent to work with me. He gave out the solution in the first 10 minutes. It takes him less than 10 minutes to write a solution as well. We discussed the solution and make it work perfectly.

Here is his performance.


I wrote the solution and also learned to fix my bug quickly in less than 10 minutes. Here is my C# solution.

I also wrote a discussion post first on Leetcode.com and will make it better presentation later. Here is the link.

Show case


The interviewee chose to show case the interview. I like to support him and thank him to allow me to learn from his hard work in the interview.

5/9/19 at 10:00 PM Massively Parallel Goose interviewed by Platinum Burrito on interviewing.io

His thought out loud from 27:00 - 35:00 is really impressing and I learn how to do it as well next time.

Mission possible: $150,000 job for 10 years (VGT)

I put it into a trial - if I can do very good on practice, then I can do a good job on daily full time job

May 9, 2019

Introduction


It is a statement like "Preparation, preparation, preparation". I put it int a trial, if I can focus on algorithm and data structure practice, I can do very good job on my daily full time job and help business grow.

Case study


Let me look into the argument, and see if I can find any facts to support this argument.


Killing me softly with his song

May 9, 2019

Introduction


It is time for me to take a break before I work on a few projects after work. I came cross this song and I like to do quick case study of the singer. Net worth, and what is her favorite songs. Here is the link.

20 minutes to study


I spent 5 minutes to read her wiki page first.


Time to review my last 50 algorithms

May 9, 2019

Introduction


It is one of learning process I should do it more often. I should review after one month practice of algorithm and data structure. Normally it includes 4 weekly contest, and then a few mock interviews I practice on Leetcode.com, algorithms I come cross to practice mock onsite. 

The review


I like to review the algorithms and also discussion posts I write on Leetcode.com. I like to learn a few hard level algorithms once a while. 


Leetcode 236

Leetcode 235

Leetcode 1038

Leetcode 1037

Leetcode 91

Leetcode 896

Leetcode 1035

Leetcode 1034

Leetcode 1033

Leetcode 402

Leetcode 957

Leetcode 1

Leetcode 2

Leetcode 13

Leetcode 675

Leetcode 1031

Leetcode 229

Leetcode 796

Leetcode 75

Leetcode 836

Leetcode 763

Leetcode 1025

Leetcode 1026

Leetcode 791    3wks 3 days

Leetcode 929

Leetcode 904

Leetcode 722

Leetcode 168 Excel sheet column title  3 weeks 4 days

Leetcode 54 Spiral Matrix

Leetcode 1024 video stitching

Leetcode 1022 Sum of Root To Leaf Binary Numbers

Leetcode 1021. Remove Outermost Parentheses

Wednesday, May 8, 2019

STOCK MARKET RISK: INVESTING IN ETFs

Here is the link.


1037. Valid Boomerang

Here is my discussion post.


Vancouver is my sweet home

May 8, 2019

Introduction


It is the international country in Canada. I have to push myself to learn from different people from all over the world. Yesterday I took a walk in Burnaby central park with my new roommate, she is a Canadian but her mom is a Phillipine.

Sweat home


We are Canadian and we all are renters. We try to reach out the community as well. My neighbor is a new immigrant and he came from Switzerland.

I also like to figure out how to embrace the life in 50s, and deal with memory loss and other challenges in my life. No matter how hard it is, I am the lucky one. People in the community in the late 30s are fighting with cancer disease. I know that my fight is much easy one.




I got contacted by Facebook Seattle recruiter today (should be yesterday)

May 8, 2019

Introduction


Now it is 12:15 AM.  I like to write a blog saying I got contacted by Facebook Seattle recruiter yesterday. I was so surprised since I got contacted by Amazon in March, Microsoft in April, Facebook in May. I know that I set my target too high, but I do like to push myself hard to prepare and solve more algorithms just for phone screen.

Email I got


Hey Jianmin!

I work with the engineering teams here at Facebook Seattle and wanted to get in touch with you.

I know that you've interviewed with us in the past and I was curious to see if you might be interested in interviewing with us again here in a few months! I'd be happy to chat with you about your experience and passions as well as your options here at Facebook.

Would you be open to speaking with me?

Thanks in advance!

Email I replied


I am so excited to hear from you and Facebook. It is so nice of you to reach out to me. I will definitely like to set up time with you for a chat using my cellular phone 604-562-xxxx. 

 I just plan what to work on this spring and think about Seattle all the time. I am setting the goal too high. But I did learn from all the experience from Amazon, Microsoft and Facebook. I only had a phone screen from Google in February 2017. Every time I have chance to be interviewed, I will analyze and then work on a few things. 

...

It is definitely my plan to have a phone screen once I can finish another 100 to 150 algorithm on Leetcode.com. I really like the experience to practice more algorithm, and push myself hard on practice. 

7 Simple Ways To Attract Money To You

Here is the article to read.



Emma Johnson

I like to do a quick short time research after I read her article related to Lewis Howes. I like to learn her writing style.

I am an award-winning journalist, blogger and podcast host. My journalism credits include The New York Times, The Wall Street Journal, O, Oprah Magazine, U.S. News and others. I'm best known for my blog, WealthySingleMommy.com, where I help professional single moms find success in career, finances, family, dating and sex. As an expert, I have appeared in Headline News, MONEY, Women's Day, The New York Times, NPR and others. My book, The Kickass Single Mom (Penguin), was a #1 bestseller. I am founder of Moms for Shared Parenting, an activist organization aimed at equally shared parenting in all families.


Tuesday, May 7, 2019

How Lewis Howes Went from Living on a Sister's Couch to Earning $1M in 2 Years

Here is the link.

I started to learn Lewis Howes from his interview with Sharapova. And I like to continue to look into his net worth, how he makes himself success in the interview business.

Upon returning home and relentlessly campaigning his parents, Howes attended the boarding school for 8th grade (where he tested at a 2nd grade reading level) and excelled at football. "I was never the biggest, fastest or strongest, or best athlete on any team I've been on. But I was always willing to sacrifice more pain to make the plays," Howes says today. " That was my gift: I was willing do whatever it took to make it happen. It came from feeling all alone as a kid -- I felt I had nothing to lose."

When Howes broke his wrist in 2007, his bank account was also broke. He moved in with his sister in Ohio, went through rehab for 1.5 years and found himself with few professional job skills at the height of the 2008-2009 recession.

Two years ago, Howes sold his education company to his partner and launched his podcast, School of Greatness, which aims to help people make a living doing what they love. The podcast has been downloaded 5 million times and consistently ranks in the Top 5 on iTunes. This month Howes is launching Greatness Magazine on iTunes, and has signed with Rodale a book contract for a title based on the same concepts that have helped him find his own success.

The keys to Howes's success:
1. Set your goals high. Howes set out to play professional football. Then make the Olympic handball team. Then build a million-dollar business. He did all three.
2. Surround yourself with greatness. Early on Howes counted as mentor Stuart Jenkins of Deckers, and later went on to network with greats in the digital marketing world, including Chris Brogan, Marie Forleo and Gary Vaynerchuk. "You are the sum of the people you spend time with," Howes says.

3. Go all in. In the past four years, training as a handball athlete, Howes has suffered two torn groins, internal throat bleeding a sprained ankle and other serious injuries.  "When I have a vision, my fear is not failing at it, I'm more afraid of not taking on the new challenge and regretting it."

a low cost diversified portfolio

Here is the link.

My portfolio is a modified Couch Potato Portfolio with the following asset allocation:
- Around 20% of my money is invested in Bonds (Ing Direct)
- Around 10% is invested in Real Estate (XRE)
- Around 17.5% is invested in Canadian equities (XIC, CDZ)
- Around 17.5% is invested in US equities (TD US IND e-series, VTI)
- Around 17.5% is invested in Emerging Market equities (VWO, XEM)
- Around 17.5% is invested in European equities (TD Euro IND e-series, VGK)

Canadian looking for advice getting started. Purchasing index funds + TFSA

Here is the link.


Canadian income-focused portfolio

Here is the discussion link.

reddit investing

Here is the link.

Today is the first time I like to find community and then I can learn and share what I learn. And also I need to verify what I learn and what area is my weakness after a month of learning on morningstar.com.


Monday, May 6, 2019

lowest common ancestor

I like to write down my practice today.

235. Lowest Common Ancestor of a Binary Tree binary search in BST
236. Lowest Common Ancestor of a Binary Tree time out using string, need help
236. Lowest Common Ancestor of a Binary Tree time out using list, need help
236. Lowest Common Ancestor of a Binary Tree optimal solution bottom up with reasoning


Follow up 


May 10, 2019


I learned one more solution, and here is the post. 

I solved my first two practice with time out problem applying the idea to find root to p or q path. Here is the solution. 

I like to make a list of things I have practiced on this algorithm:


Recursive
1. Using recursive, learn how to define recursive function, simple and clear.

BFS
I also study the code and write a C# solution using BFS to store all nodes with their parent node. 

Backtracking 
I learn to solve timeout issue in my naive solution in the first practice 2019. 

Also backtrack space complexity is much less compared to my naive approach. 

Post order traversal - bottom up 
How to define a simple and easy recursive function? I learn one solution and like it. 

The solution folder is here. 


Topics 
  1. BFS
  2. child-parent map
  3. Fix naive solution timeout with complicated function
  4. how to build a path from p or q to root
  5. how to build a path from root to p
  6. Naive solution with Timeout and Complicated function
  7. Post order traversal
  8. recursive function - Do not understand
  9. Recursive solution Easy to understand
  10. Recursive solution with backtracking
  11. Timeout challenge

Here is the folder to look up problems and solution based on topics I worked on. 


Follow up 


May 29, 2019
I continue to learn the algorithm as an interviewer on interviewing.io, I give out the algorithm to interview others more than three times, one time the interviewee is Amazon SDE II in Seattle, he showed me how to design a recursive function to return if one node is found in recursive function, in early May; And later, on May 28, 2019, one engineer showed me how to solve it using recursive function assuming that given node p and q in binary tree, and he is an engineer in Motorola. 


Topics

Naive solution with Timeout and Complicated function
Timeout challenge (May 7, 2019)
Timeout challenge - using a string to store path (May 7, 2019)
Fix naive solution timeout with complicated function (May 13, 2019)
learn elegent solution using back tracking and space efficiency, avoid timeout (May 23, 2019)


June 25, 2019
Three practice for three ideas; I like to be a master of the lowest common ancestor!
find one path first and then look up path for second given node q
C# find path from given node p to root first and then find q and lowest common ancestor
find one path first top down and then look up path for second given node q
C# Find top down path for a given node p and then find q's path and look up lowest common ancestor
backtrack to find path from root node to given node p
C# backtrack to find root node to given node p

Stock Market IQ Test

Here is the link.

Your Risk Tolerance

Here is the link.


QUIZ | Test Your Investing Instincts

Here is the link.


Beginners' Guide to Asset Allocation, Diversification, and Rebalancing

Here is the article to read.

Why Asset Allocation Is So Important

By including asset categories with investment returns that move up and down under different market conditions within a portfolio, an investor can protect against significant losses. Historically, the returns of the three major asset categories have not moved up and down at the same time. Market conditions that cause one asset category to do well often cause another asset category to have average or poor returns. By investing in more than one asset category, you'll reduce the risk that you'll lose money and your portfolio's overall investment returns will have a smoother ride. If one asset category's investment return falls, you'll be in a position to counteract your losses in that asset category with better investment returns in another asset category.

Financial Navigating in the Current Economy: Ten Things to Consider Before You Make Investing Decisions

Here is the link.


  1. Draw a personal financial roadmap.
  2. Evaluate your comfortable zone in taking on risk
  3. Consider an appropriate mix of investments
  4. Be careful if investing heavily in shares of employer's stock or any individual stock
  5. Create and maintain an emergency fund
  6. Pay off high interest credit card debt
  7. Consider dollar cost averaging
  8. Take advantage of "free money" from employer
  9. Consider rebalancing portfolio occasionally
  10. Avoid circumstances that can lead to fraud


9.         Consider rebalancing portfolio occasionally. 
Rebalancing is bringing your portfolio back to your original asset allocation mix.  By rebalancing, you'll ensure that your portfolio does not overemphasize one or more asset categories, and you'll return your portfolio to a comfortable level of risk.
Stick with Your Plan: Buy Low, Sell High -- Shifting money away from an asset category when it is doing well in favor an asset category that is doing poorly may not be easy, but it can be a wise move.  By cutting back on the current "winners" and adding more of the current so-called "losers," rebalancing forces you to buy low and sell high.
You can rebalance your portfolio based either on the calendar or on your investments.  Many financial experts recommend that investors rebalance their portfolios on a regular time interval, such as every six or twelve months.  The advantage of this method is that the calendar is a reminder of when you should consider rebalancing.  Others recommend rebalancing only when the relative weight of an asset class increases or decreases more than a certain percentage that you've identified in advance.  The advantage of this method is that your investments tell you when to rebalance.  In either case, rebalancing tends to work best when done on a relatively infrequent basis.

10 reasons why people fail when they start investing

Here is the link.


  1. Emotions
  2. Not knowing what you own
  3. Not doing the homework
  4. Waiting for the right moment
  5. Refusing to diversify
  6. Trusting the news
  7. Buying too many speculative stocks
  8. Not having a strategy
  9. Not selling their winners
  10. Failing to learn from their mistakes
I also like to find the emotion diagram and paste in the following:




How to Make Money in Stocks

Here is the link.

The stock market’s average return is a cool 10% annually — better than you can find in a bank account or bonds. So why do so many people fail to earn that 10%, despite investing in the stock market? Fear and greed.
The key to making money investing in stocks is remaining in the stock market; your length of “time in the market” is the best predictor of your total performance. It’s critical to understand how your emotions can fool you into moving in and out of the stock market at the worst possible times, missing out on that annual return.
If that’s not convincing, consider this. Over the 15 years through 2017, the market returned 9.9% annually to those who remained fully invested, according to Putnam Investments. However:
  • If you missed just the 10 best days in that period, your annual return dropped to 5%.
  • If you missed the 20 best days, your annual return dropped to 2%.
  • If you missed the 30 best days, you actually lost money (-0.4% annually).
To avoid both of these extremes, investors have to understand the typical lies they tell themselves. Here are three of the biggest:

1. ‘I’ll wait until the stock market is safe to invest.’

This excuse is used by investors after stocks have declined, when they’re too afraid to buy into the market. Maybe stocks have been declining a few days in a row or perhaps they’ve been on a long-term decline. But when investors say they’re waiting for it to be safe, they mean they’re waiting for prices to climb. So waiting for (the perception of) safety is just a way to end up paying higher prices, and indeed it is often merely a perception of safety that investors are paying for.
What drives this behavior: Fear is the guiding emotion, but psychologists call this more specific behavior “myopic loss aversion.” That is, investors would rather avoid a short-term loss at any cost than achieve a longer-term gain. So when you feel pain at losing money, you’re likely to do anything to stop that hurt. So you sell stocks or don’t buy even when prices are cheap.

2. ‘I’ll buy back in next week when it’s lower.’

This excuse is used by would-be buyers as they wait for the stock to drop. But as the data from Putnam Investments show, investors never know which way stocks will move on any given day, especially in the short term. A stock or market could just as easily rise as fall next week. Smart investors buy stocks when they’re cheap and hold them over time.
What drives this behavior: It could be fear or greed. The fearful investor may worry the stock is going to fall before next week and waits, while the greedy investor expects a fall but wants to try to get a much better price than today’s.

3. ‘I’m bored of this stock, so I’m selling.’

This excuse is used by investors who need excitement from their investments, like action in a casino. But smart investing is actually boring. The best investors sit on their stocks for years and years, letting them compound gains. Investing is not a quick-hit game, usually. All the gains come while you wait, not while you’re trading in and out of the market.
What drives this behavior: an investor’s desire for excitement. That desire may be fueled by the misguided notion that successful investors are trading every day to earn big gains. While some traders do successfully do this, even they are ruthlessly and rationally focused on the outcome. For them, it’s not about excitement but rather making money, so they avoid emotional decision-making.

What Is the Average Stock Market Return?

Here is the link.

Stock market returns average 10%

The S&P 500 index comprises about 500 of America’s largest publicly traded companies and is considered the benchmark measure for annual returns. When investors say “the market,” they mean the S&P 500.
Measured by the S&P 500 index, stocks return an average of about 10% annually over time.
Keep in mind: The market’s long-term average of 10% is only the “headline” rate: You’ll lose purchasing power of 2% to 3% every year due to inflation, which puts the market’s average inflation-adjusted return at about 7% to 8% annually.
The below table compares average annual stock market returns to current bond and online savings account rates, as of March 2019.

SUSA Scotia Strategic U.S. Equity ETF Portfolio

Here is the link.


Case study: 2010 Second quarter Par 401 K statement review

May 6, 2019

Introduction


It is my personal finance research. I like to push myself to review only two quarter statements I can find related to my 401 K Par technology Inc with Charles Schwab starting from 2017. The statement is for April 1 to June 30, 2010 time period.

Case study


I will come back to write more here later.