Tuesday, September 24, 2019

What if I purchase $10,000 US dollar ROSS stock back in 1999?

Sept. 24, 2019

Introduction


It is my personal finance research. I am thinking about hard working, but also I am thinking what if I were so smart back in 1999. I purchased brand new Ford Explorer, I frequently shopped on ROSS store, but I never thought about ROSS stock price back in 1999. What if I purchase $10,000 us dollars ROSS stock in 1999?

Case study


The stock price of ROSS back in 1999 is around $2.0 dollars. The stock price in Sept. 24, 2019 is $100.00 dollars. 50 times more. If I make the purchase, then I can retire now.

I just could not believe that life can be so easy. I can write code every day, every hour. Just for fun, entertain myself with tough algorithms.

Here is my github folder to show how much I spent on ROSS store around 1999 to 2001. I just could not believe that I was lack of business education, emotional, and impulsive shopping twenty years ago.

Financial data


Here is the link.
Ross Stores Historical Annual Stock Price Data
YearAverage Stock PriceYear OpenYear HighYear LowYear CloseAnnual % Change
201998.171283.7800109.360083.0800108.240030.10%
201885.821280.5000103.330074.840083.20003.68%
201764.168265.610080.960053.030080.250022.33%
201659.518754.370069.530052.100065.600021.91%
201550.495946.865056.530044.810053.810014.17%
201436.728537.135047.130031.075047.130025.80%
201333.279727.220040.820027.220037.465038.53%
201230.111623.645034.990023.645027.045013.80%
201119.382615.970024.485015.550023.765050.29%
201013.620410.672516.417510.672515.812548.09%
20099.99097.702512.11507.062510.677543.66%
20088.09626.252510.32755.37007.432516.27%
20077.51737.62258.71506.17006.3925-12.73%
20066.99097.36007.84505.70007.32501.38%
20056.81596.93007.60255.67757.22500.10%
20046.67706.53258.21255.28757.21759.11%
20035.55795.40386.99384.12136.615024.84%
20024.89054.08385.82754.01255.298832.14%
20013.11072.10134.14882.10134.010090.05%
20002.08832.16383.00751.53132.1100-5.91%
19992.68672.39883.25002.13252.2425-8.89%
19982.42892.25813.10561.52752.46138.25%
19971.92031.56252.61311.26192.273845.52%
19961.07830.61721.63690.58981.5625161.38%
19950.42440.33220.64840.30080.597870.02%
19940.45460.41030.54690.34000.3516-13.46%
19930.51340.62910.73440.40250.4063-35.42%
19920.50980.50410.69530.34380.629123.89%
19910.38340.18750.57030.15230.5078170.83%
19900.29280.44160.45310.13670.1875-57.89%
19890.53020.32810.76940.31630.445335.72%
19880.24100.14060.34380.14060.3281154.74%
19870.22320.15630.34000.11310.1288-13.21%
SectorIndustryMarket CapRevenue
Retail/WholesaleRetail - Discount & Variety$38.716B$14.984B

Actionable Items



I am looking for ideas how to invest as a 53 years old Chinese Canadian. It is the first year I work on personal finance research. I start to learn that there are so many investment opportunity around our daily life.

I like to take some time to write down my thought process, and later on I can review and see what is the right direction for me to continue my research.

Passive income is definitely a good choice for me. Since I only have limit time to work to exchange time for money. I have a full time job, and also I like to educate myself, do it by myself.

Romans 5:4, CSB: "endurance produces proven character, and proven character produces hope."

Case study: word ladder find all paths

Sept. 24, 2019

The interview lasted one hour 7 minutes, the first 50 minutes or so the interviewee worked on the algorithm. We had some discussion about how to improve the algorithm.

The interviewee went to Google, Amazon, Uber and Microsoft onsite. He also showed how to run the code using pseduo code. It is such a good learning expereince for me.

Transcript starts from here.


End here

1202. Smallest String With Swaps

Sept. 24, 2019

Introduction

It is time for me to go back to routine to write code every day. I like to push myself hard to work on more than one algorithm a day.

Warmup practice, here is the link.

C# union find algorithm warmup practice in 2019


It is a classical union find algorithm. What I like to do is to warm up the algorithm, write the solution from scratch. This is second practice, warmup. The first one was written yesterday, Sept. 23, 2019, and I make it working and also remove redundant code. My first practice with a discussion post, here is the link.
Union find algorithm
I also took a few minutes to write down the ideas to solve the problem. I think that it is a good start, later on I may come out better ideas to solve the problem.
The idea is to apply union find algorithm, and then all chars in each disjoint set should be sorted; next go over the original string again, find each disjoint set by the index position, and concatenate the smallest char not applied to the smallest string.
The tip is to copy each disjoint set to a dictionary, the key is index of position, the value is Queue which stores sorted chars.
The most challenging part is to write union find algorithm. Instead of using UnionFind class, I only write two APIs, one is called find(int[] parent, int id) which has path compression functionality; the second one is to union two disjoint set, regardless of the size of disjoint set.
Online judge
The warmup practice the online judge caught me a few places. I had to read my own code, and fixed them one by one.
I like to write down those mistakes, and I also like to start to work on testing by myself in daily practice.
  1. Set parent[i] = i; at the very beginning;
  2. Do not mix index value i with find(int[] parent, int i); using latter one instead for disjointSets;
  3. sorted variable key should be find(parent, i), not i.
  4. Motivate myself to test my own code. This warm up I failed four times.
It is so interesting to observe my weakness. I should read my own code first, test my own code manually a few times, make sure no mistake, and then submit the code against online judge. Do not depend on online judge.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace unionFind
{
    class Program
    {
        static void Main(string[] args)
        {
            RunTestcase1();
            //RunTestcase2(); 
        }

        public static void RunTestcase1()
        {
            var pairs = new List<IList<int>>();

            pairs.Add((new int[] { 0, 3 }).ToList());
            pairs.Add((new int[] { 1, 2 }).ToList());

            var result = SmallestStringWithSwaps("dcab", pairs);
            Debug.Assert(result.CompareTo("bacd") == 0);
        }

        public static void RunTestcase2()
        {
            var pairs = new List<IList<int>>();

            pairs.Add((new int[] { 0, 3 }).ToList());
            pairs.Add((new int[] { 1, 2 }).ToList());
            pairs.Add((new int[] { 0, 2 }).ToList());

            var result = SmallestStringWithSwaps("dcab", pairs);
            Debug.Assert(result.CompareTo("abcd") == 0);
        }

        /// <summary>
        /// Leetcode 1202 - smallest string with swaps
        /// The idea is to apply union find algorithm, and then all chars in each disjoint set should be sorted; 
        /// next go over the original string again, find each disjoint set by the index position, and concatenate 
        /// the smallest char not applied to the smallest string. 
        /// The tip is to copy each disjoint set to a dictionary, the key is index of position, the value is 
        /// Queue<char> which stores sorted chars. 
        /// 
        /// The most challenging part is to write union find algorithm. Instead of using UnionFind class, I only write
        /// two APIs, one is called find(int[] parent, int id) which has path compression functionality; the second one
        /// is to union two disjoint set, regardless of the size of disjoint set. 
        /// </summary>
        /// <param name="s"></param>
        /// <param name="pairs"></param>
        /// <returns></returns>
        public static string SmallestStringWithSwaps(string s, IList<IList<int>> pairs)
        {
            if (s == null || s.Length == 0)
                return string.Empty;

            var length = s.Length;
            var parent = new int[length];

            for (int i = 0; i < length; i++)
            {
                parent[i] = i; 
            }

            foreach (var pair in pairs)
            {
                union(parent, pair[0], pair[1]);
            }

            var disjointSets = new Dictionary<int, IList<char>>();
            for (int i = 0; i < length; i++)
            {
                var key = find(parent, i);

                if (!disjointSets.ContainsKey(key))
                {
                    disjointSets.Add(key, new List<char>()); 
                }

                disjointSets[key].Add(s[i]); 
            }

            // sort chars, and save those chars into Queue data structure
            var sorted = new Dictionary<int, Queue<char>>(); 
            foreach(var pair in disjointSets)
            {
                var key = pair.Key; 
                var values = pair.Value;
                
                // Sort chars first
                var array = values.ToArray();
                Array.Sort(array);

                var queue = new Queue<char>(array); 
                sorted.Add(key, queue);                 
            }

            var sb = new StringBuilder();
            for(int i = 0; i < length; i++)
            {
                var key = find(parent, i);
                var item = sorted[key].Dequeue(); 
                sb.Append(item); 
            }

            return sb.ToString();                 
        }

        /// <summary>
        /// find parent node - with path compression
        /// all node along the leaf to root node are flattened 
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node"></param>
        /// <returns></returns>
        private static int find(int[] parent, int node)
        {
            return (node == parent[node]) ? node : parent[node] = find(parent, parent[node]);                 
        }

        /// <summary>
        /// union find algorithm - union two disjoint sets
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node1"></param>
        /// <param name="node2"></param>
        private static void union(int[] parent, int node1, int node2)
        {
            var parent1 = find(parent, node1);
            var parent2 = find(parent, node2);

            if (parent1 == parent2)
                return;            

            parent[parent1] = parent2; 
        }
    }
}

The best tech stocks to buy now - 2019

The best tech stocks to buy now:

10 of the Best Tech Stocks to Buy for 2019 - Twitter

Twitter (TWTR)
The bearish sentiment on Silicon Valley entering the New Year was evident when looking at Twitter; although CEO Jack Dorsey had undertaken a large-scope campaign to clean up the platform and eliminate fake accounts – and that had helped yield 29% revenue growth in Q3 2018 – analysts were expecting just 13% revenue growth in 2019. This estimate was highlighted as “a conservative figure likely to be eclipsed” in U.S. News’ list of the best tech stocks at the top of the year. Indeed, analysts now expect over 17% top-line growth in 2019, and shares have handily outperformed the market due to a series of impressive quarterly results.
YTD return: 46%

10 of the Best Tech Stocks to Buy for 2019 - Adobe

Adobe (ADBE)
One of the major beneficiaries of the shift to the cloud over the last decade, creative software powerhouse Adobe has been able to maximize scalability, boost margins and create more recurring revenue through its suite of software products. The company behind Photoshop, Lightroom, Illustrator, InDesign, Dreamweaver and Adobe XD, customers can subscribe to all of these services via the Adobe Creative Cloud for $600 per year. Millions of subscribers are doing just that, from individual artists and creators to corporate marketers, designers and advertisers all over the world. Adobe’s name brand, ecosystem of products and superb reputation locks users in, and despite being worth well over $100 billion, revenue is still growing about 25% a year.
YTD return: 27%

10 of the Best Tech Stocks to Buy for 2019 - Facebook

Facebook (FB)
Last year was a rough year for Facebook, as it dealt with fallout from its privacy breaches and role in meddling in the 2016 elections. CEO Mark Zuckerberg was called before Congress and grilled. It wasn’t a good look. This year, however, came some practical consequences: Facebook settled with the Federal Trade Commission for $5 billion over its handling of user data and deceptive communications to users. That said, markets brushed that off, and despite the specter of further regulation as big tech firms come under the spotlight of domestic and international regulators, Facebook – which owns Instagram and WhatsApp as well – remains one of the best tech stocks to buy.

Among the 10 best tech stocks to buy for 2019 - StoneCo

StoneCo (STNE)
Among the 10 best tech stocks to buy for 2019, StoneCo was the highest risk/reward play. A relative unknown in the U.S., the Brazilian fintech, analogous to Square (SQ) domestically, had been growing like a weed and was fresh off a 2018 IPO. Usually newly public companies debut at overhyped valuations and it takes time to settle into proper trading ranges. STNE has seen enormous volatility, but StoneCo’s price in the months after its IPO is proving too conservative, not too inflated; revenue jumped 57% last quarter and EPS nearly tripled. The stock is the single biggest winner on this list, proving once again that Warren Buffett’s Berkshire Hathaway (BRK.A, BRK.B), an early investor, is as savvy as they come.
YTD return: 64%

10 of the Best Tech Stocks to Buy for 2019 - Apple

Apple (AAPL)
The world’s second-most valuable company, Apple is a veritable cash cow due largely to its blockbuster product the iPhone. Founder Steve Jobs’ decision to adopt a closed ecosystem in which Apple makes its own hardware and software has built a massive, cultish fan base that generates tens of billions in recurring revenue each quarter. Apple TV+, the company’s long-awaited streaming video service, is coming this fall for $9.99 a month. The tech giant returned $21 billion to shareholders last quarter through buybacks and dividends, and will keep funneling back cash going forward. Services revenue – Apple’s biggest source of margin improvement – grew 13% to an all-time high of $11.46 billion last quarter.
YTD return: 29%

10 of the Best Tech Stocks to Buy for 2019 - Amazon

Amazon.com (ticker: AMZN)
Amazon stock remains a winner – and definitely one of the best tech stocks to buy for 2019. Having finally reached a stage in its corporate evolution where the company is consistently profitable, Amazon started off 2019 with its fourth straight quarter of record-setting profits on the back of AWS, its cloud computing business. Shares took a hit after Q2 earnings, however, when investing over $800 million in Prime same-day delivery boosted sales but hit profits. Believe it or not, foregoing short-term profit for long-term gains is wise, and AMZN remains a top-tier tech stock.

Year-to-date return (through Aug. 28): 17%

Better Buy: TJX Companies vs. Ross Stores

Here is the article.

Growth and potential


TJX, which owns both TJ Maxx and Marshall's brands, had a total of 2,285 U.S. discount stores as of February. The company also has 671 HomeGoods stores, 454 TJX Canada stores, and 564 TJX International stores (Europe and Australia), for a grand total of 4,070 stores. Ross, on the other hand, had only 1,409 Ross stores along with 213 dd's DISCOUNTS, for a total of 1,622 stores.
Both companies grew their same-store sales at 3% last quarter. Should that continue, future growth will largely be determined by new store openings. With less than half of TJX's store count, Ross theoretically has more room to grow and thus may sustain the higher growth rate it's had over the past three years.

Valuation


The final showdown comes down to valuation. Because Ross Stores has superior growth prospects, I'd expect it to have a slightly higher valuation, and that's indeed the case. On the basis of both a forward price-to-earnings ratio, as well as the EV-to-EBITDA ratio, Ross carries a slightly higher valuation.
TJX has a higher dividend yield (around 1.6% at current prices), which may lead some to think that TJX may be the choice for value investors. Ross stock yields closer to 1%.
Investors should note, however, that TJX pays out more of its earnings as a dividend, with a payout ratio nearly twice that of Ross. In addition, Ross has bought back more of its market capitalization over the past 12 months than TJX. That means that Ross still is returning a lot of money to shareholders and has the potential to increase its dividend more in the future. 


Case study: clothing shopping from Ross store from 1996 to 2016

Sept. 24, 2019

Introduction


It is my personal finance research. I did study ROSS stock, in 1998 the stock price is $2.00, in 2019 the stock price is around $100.00 dollars. I spent thousands dollars on ROSS store from 1996 to 2001, but I never purchased any ROSS store.


Case study


What ideas can I come out to do this case study?



The chain hailed by Wall Street as a 'retail treasure' runs the most disastrous store we've ever seen

Here is the article.

Customers didn't seem to mind the mess. There was a steady line of people checking out while we visited and more than 20 shoppers throughout the store. The messy environment is likely a product of Ross's efforts to keep prices low by investing less in labor and infrastructure — like construction and display costs — than full-priced department stores.Ross' earnings for the most recent fiscal year grew 10% to $14.1 billion.

Monday, September 23, 2019

2 Growth Stocks I’d Buy Right Now

Here is the article.

Life is such an interesting journey. I did google and search what stock I should purchase in 2019. I came cross this article. But I read the article and finish in a few minutes, I did not know the brand name wayfair at all.

Tonight I met an engineer on interviewing.io, he has super good performance. So I had chance to read the article again.




Case study: Word ladder find all paths

Sept. 23, 2019

Introduction


It is my mock interview as an interviewer. I just could not believe that the interviewee had super good performance, he wrote the code and tested the code, no bug, executable code.

Case study


Let me show the code I reviewed.
End of python code

Here is my feedback as an interviewer.


Here is the feedback from the interviewee.



1201. Ugly Number III

Sept. 23, 2019

Introduction


It is the algorithm to remind me to work on my analytical skills. I did not think carefully, and then I worked on a naive solution and tried to figure out how to solve the timeout issue. It is such a good reminder for me to go back to work on my analytical skills.

Analytical skills


Algorithm practice is the best way for me to train myself analytical skills. Specially those problems are newly designed and need fresh idea to break through.

I also need to find things to work on. It is such a simple and easy to understand algorithm. But I learned the mistakes I had, I should go back to work on the basics.


Soojin Kwon: "The Importance of Owning your Future" | Talks at Google

Here is the link. I like to spend 37 minutes to watch the video.

30:00

The most of important is to change the way you think.


Here are the three things one JP Morgan strategist is watching that could drive markets higher

Here is the video.

What Phil's watching
Market's next catalysts

  • Growth story
  • Valuations
  • Technical tailwinds
What will drive the market?

Phil Camporeale 
JPMorgan Asset Management

SPY - SPRD S&P 500 ETF +19.63%
ISHARES 20+ Year Treasure BOND (TLT) +16.75%





What I learn last 10 years at work?

Sept. 23, 2019

Introduction


It is my personal finance research. What I did is to look into what  I learn first six years in Vancouver, and what I learn last 10 years at my current job. It is an honest review again and again, and see what I should work on next.

2010 - 2015


I started the full time working for current job starting from June 2010. I wish that I have spent time early on algorithm and data structure practice. I started to work on Leetcode starting from January 2015.

2018 - Now


I noticed that I need to start personal finance research. I should have learned how to invest starting from June 2010.