Saturday, January 23, 2021

Bestbuy.com: Samsung - 5.9 cu. ft. Convection Freestanding Electric Range - Stainless steel

 Jan. 23, 2021

Here is the link. 

Samsung

Samsung - 5.9 cu. ft. Convection Freestanding Electric Range - Stainless steel

Model:NE59M4320SS
SKU:5713571

GE

GE - 5.3 Cu. Ft. Freestanding Electric Range - Black

Model:JBS60DKBB
SKU:5135501

Your price for this item is $549.99
Or
$45.84/mo.See disclaimers from Show me how button 1
suggested payments with 12-Month Financing

My parking lot: East 6th ave Vancouver

Jan. 23, 2021

 I do not know very well the community parking along the street until a real estate agent talked to me. I also learned that two bedroom home costs $710,000 dollars on the market right now. 

One condo on sale

Carole Dandurand

Real Estate Advisor/REALTOR®

604-240-6015

T 604-224-5277

carole@dandurand.ca

Here is the link. 

314-621 East 6th Avenue | Mount Pleasant, Vancouver East

NEW LISTING

Asking Price: $799,000

  • Built in 1974
  • 798 sq.ft. home
  • 2 bedrooms
  • 1 bathroom
  • 1 secure underground parking stall
  • 1 storage locker
  • Zoning: RM4
  • Taxes $1,775.82 (2020)
  • Monthly strata fees of $412.70 includes garbage pickup, gardening, heat, hot water, and management

MLS# R2529649

Range hunt: Internet #206942890 Model #JBS60DKWW Store SKU #1001763719 Store SO SKU #1001760236

 Jan 22, 2021

Here is the link. 

I spent near one hour to evaluate search product features of home depot. I learned a few things. I need to purchase a glasstop electronic range. I thought about Amazon customer obsession leadership, and I think that it is better for me to replace a new range for the renter. 

Two coils are working, but the renter said only one is working. It is hard for me to argue since I live in Canada, the renter is in Florida. 



Friday, January 22, 2021

Expr stock: Jan. 22, 3 PM 1.17 - 4 PM 2.1 - 6 PM - 2.7 - A rookie investor

 Jan. 22, 2021

Introduction

It is important for me to learn how to sort priority. I was thinking about my rental property - a range, looked up bestbuy and home depot. But I did not set priority, purchased $10,000 US dollar EXPR stock as I made plans several time. I like to write down my story as an investor. 

EXPR stock - up from $1.1/ share to $2.7/ share

I like to document the process, and will come back to learn from my own experience. 













Lessons learned

I should write down lessons I learned from this short term investment project, start from biggest mistakes, and then write down one by one. 

  1. Biggest mistake, I did not sort priority. I was told by the rental, the electronic range needs to be replaced with four working coiling wire. I spend time to study home deport search feature and best buy search feature. And I spent time to study how good the design is, how to make improvements. I should set up priority, purchase $10,000 US dollars as planned several times, EXPR stock;
  2. I did some timing, last rebound is from 0.90/ share to 1.50/ share, and pullback to $1.1. I waited two days, but I was not sure if it is good buy at price $1.17. I should think the other end, when I sell, try to sell 20% more, when I buy, get in the fast moving train first. 
  3. I did not sell for profit at $1.40/ share, based on my experience, $400 gains do not help me. I need to time the market to get in. I may miss big gains. 
  4. I learned from my last year HSE.TO lesson, I purchased $10,000 dollars HSE.TO stock, and then 30% drop, I cheated myself, sold and bought back several times, but at the end, I missed 100% gains. The safest way is to add more share when price goes down. 
  5. I did not feel stress this time when my positions of EXPR went down 900 dollar loss. I knew that it is normal. Think about intrinsic value instead. 
  6. I should think about setting up project, for 30% loss, 1.17 to 0.90, and then over 100% gains, from 1.17 to 2.17. More than 3 times more gains compared to the risk. 
  7. I made mistake to sell 2400 shares. This was the first time I sold the stock in 2021, I made mistake, bought another 2400 shares of 1.9. I was panic to sell, in 4 minutes, I noticed that price was 2.1. 4800 shares, 4 minutes, 20 cents, extra 960 dollars gains. 
  8. I spent time to watch youtube.com video, studied CEO of AT & T, and other retail industry CEO interview. I understood how tough it is. 
  9. Express has over 14,000 employees. Most of jobs are low wage jobs as I have. I do think that it is important for USA to get back those jobs to help recovery. 
  10. Pandemic is best opportunity to build wealth. I have psychology problem, since I am afraid to lose money. I have not made over $10,000 dollars gains on stock market. That is part of reason I did not purchase and prepare early. 
  11. I asked the advice to purchase 10,000 share of EXPR, some of them told me that it is gambling. 
  12. My friends in wechat group told me to sell when price was around $1.4, $1.6. No one tried to get in and catch big return. Last return was 50%, but this time it was 170%, 35,000,000 shares from 3 PM to 4 PM, after market close, two hours another 20,000,000 shares. 
  13. Hard work is important. I do think that I need to learn more about business, manage myself better, set up priority, do not depend on others to make decision. Share and enjoy sharing, help others. Learn to collaborate, listen to others. 
  14. Being single is most challenge life. I worked so hard over 10 years, but I could purchase $50,000 US dollars last two days, catch 100% rebound after Biden inauguration. 

Thursday, January 21, 2021

Sven Carlin: INFLATION AHEAD - STOCK MARKET NEWS - $2.3 TRILLION STIMULUS, HUGE DEFICIT, PERHAPS HYPERINFLATION

Jan. 21, 2021

Here is the link. 

With all the announced stimulus, the FED's balance sheet going to $10 trillion, it is time to discuss Inflation and perhaps even hyperinflation. Government deficits are huge and will be only growing, thus currencies have to be debased! There is no other way. So, protect yourself and own real assets. This is also the reason why stocks have been going up even as we are entering the mother of all recessions. When it comes to the stock market, investing in stocks, looking for inflation protection, it is always about real assets. Enjoy the stock market news for today. Want to know more about my research and portfolios? Here is my independent stock market analysis and research! STOCK MARKET RESEARCH PLATFORM (analysis, stocks to buy, model portfolio) https://sven-carlin-research-platform...


Financial stimulus - Inflation - sideline - park everywhere - even more printing - into the market 

Stock overvalue - 

Leetcode discuss: 1246. Palindrome Removal

 Jan. 21, 2021

Here is the link. 

First practice - C# - DP - Patience

Jan. 21, 2021
Introduction
It is the last algorithm in Leetcode premium Microsoft mock onsite. I could not finish the code in mock interview. I understood that it can be solved using brute force all possible subproblems using two dimension dynamic programming.

Case studies
It is important for me to play with the following test cases first, understand the value of minimum move, and then write a solution to match the analysis.
Case 1:
[1, 3, 4, 1], it should be 2, not 3. I wrote the code and then failed the test case by online judge. And then I learned to analyze the case. Remove 4, [1, 3, 1] should be able to be removed once since it is palindrome.
Case 2:
[1, 3, 4, 1, 5], it should be 3, not 4. One of solutions is to remove 4 first, then remove [1, 3, 1], and then remove [5].
Lessons I learn:

  1. Make sure that all possible answers are considered from 1 to 2 to bigger number.
  2. Edge case - take first number and last number out, solve [3, 4, 1] first. This idea can lead to answer 1 as minimum move, it is the only way. All other ways has at least 2 minimum moves.
  3. Brute force all possible ways to break into subproblems.

Time spent
I spent more than two hours to make it work. It is important for me to work independently, since I already solved over 600 algorithms. I like to trian myself to think hard, longer, and solve a hard level algorithm by myself.

Continue to simplify
After the first success submission and writing of this post, I spent another 15 minutes to simplify the code, remove redudant code, and make it concise and working.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace minimumMove
{
    class Program
    {
        static void Main(string[] args)
        {
            //var result = MinimumMoves(new int[]{1, 3, 4, 1});
            //var result = MinimumMoves(new int[] { 1, 3, 4, 1, 5 }); 
            var result = MinimumMoves(new int[] { 19, 4, 9, 11, 19 }); 
        }

        /// <summary>
        /// Leetcode - 1246. Palindrome Removal
        /// </summary>
        /// <param name="arr"></param>
        /// <returns></returns>
        public static int MinimumMoves(int[] arr)
        {
            if (arr == null || arr.Length == 0)
                return 0;

            var n = arr.Length;
            var dp = new int[n, n];

            dp[0, 0] = 1;
            for (int end = 1; end < n; end++)
            {
                // dp[0, end], ..., dp[end - 1, end] backward          
                dp[end, end] = 1;
                for (int i = 1; i <= end; i++)
                {
                    var left = end - i;
                    var right = end;

                    // [1, 3, 4, 1], dp[0, 3] = 2, not 3,
                    var bothEndSame = arr[left] == arr[right];

                    var count = right - left + 1;
                    var min = count;

					var dpCenter = 0; 
                    if (count > 2)
                    {
                       dpCenter = dp[left + 1, right - 1]; // exclude both ends
                    }
                   
                   min = 2 + dpCenter;
                   if (bothEndSame)
                   {
                     min = dpCenter; // [1, 2, 3, 4, 1]     
                     if(count == 2)
                     {
                         min = 1; 
                     }                                                                    
                   }                   

                    for (int k = left + 1; k <= end; k++)  // [1, 3, 4, 1, 5] -> dp[0, 3] + dp[4, 4]
                    {
                        min = Math.Min(min, dp[left, k - 1] + dp[k, end]);
                    }

                    dp[left, end] = min;
                }
            }

            return dp[0, n - 1];
        }
    }
}

Leetcode discuss: 1576. Replace All ?'s to Avoid Consecutive Repeating Characters

 Jan. 21, 2021

Here is the link. 

First practice - C# - "abc" - 20+ minutes

Jan. 21, 2021
Introduction
It is my first algorithm in Microsoft mock onsite. It took me over 20 minutes to calm down, and I like to simplify my solution, avoid so many if case.

Case study
"abc" is chosen to replace all '?' chars, since there is at most two neighbors for any '?' char, it is working to find one char left after removing those two neighbor chars.

I thought about cases if there is left neighbor or right neighbor, if it is '?' or not. I think that it is better to remove two neighbor chars, first one left will be chosen.

It is my way to replace. I wish that I can solve it in less than 10 minutes. But in reality, I took two days break to practice mock onsite. I tried to learn one hard level in my previous one. I have hard time to focus and think quickly.

The following code passes online judge.

public class Solution {
    public string ModifyString(string s) {
        if(s == null || s.Length == 0)
        {
            return "";
        }               
       
        var arr = s.ToCharArray(); 
        
        var length = s.Length; 
        
        for(int i = 0; i < length; i++)
        {
            var current = s[i];
            var empty = current == '?';
         
            var replaced = new HashSet<char>("abc".ToCharArray());
            
            if(!empty)
            {
                continue; 
            }
            
            if(i > 0)
            {
                replaced.Remove(arr[i - 1]);
            }
            
            if(i < length - 1)
            {
                replaced.Remove(arr[i + 1]);
            }
            
            arr[i] = replaced.ToList()[0];
        }
        
        return new string(arr); 
    }
}

Leetcode discuss: 1375. Bulb Switcher III

Jan. 21, 2021

Here is the link. 

First practice - C# - O(1) to check all lights are blue - 30+ minutes

Jan. 21, 2021
Introduction
It is very good practice although I made it work in less than 48 minutes in mock onsite interview - Microsoft. I spent over 15 minutes to think about how to find any light should be set to blue using O(1) time, just check it's left neighbor.

Design issue
It took me at least 10 minutes to figure out how to use O(1) to check if the current light can set to blue or not.

The status array is declared to store all position light status, 0 - off, 1 - on, 2 - blue.

Any light can be changed from 'on'(1) to 'blue'(2) only once. It is easy to argue and prove it. When a light is set to blue, the right neighbor should be checked one by one if needed to change from on to blue.

For example, [2, 1, 3, 5, 4]
First light is at position of index = 1, second light is at position of index = 0 which should be blue (no left neighbor). Next to check it's right, index = 1, status[1] = 1, change it to 2.

Performance
It took me over 20 minutes to fix bugs. I mixed variable current with i inside for loop. It is better for me to name current variable with meaningful name to avoid mixing with i.

The current variable should be better named as placeHolder, left neighbor is placeHolder - 1, right neighbor is placeHolder + 1. I will think more later for better naming.

Time complexity
O(N), N is the length of the array

Space complexity
O(N), N is the length of the array

The following code passes online jduge

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TurnOnLights
{
    class Program
    {
        static void Main(string[] args)
        {
            var light = new int[] { 1, 6, 3, 4, 5, 7, 2, 8, 9, 10 };

            var result = NumTimesAllBlue(light); 
        }

        public static int NumTimesAllBlue(int[] light)
        {
            if (light == null || light.Length == 0)
            {
                return 0;
            }

            var length = light.Length;
            var status = new int[length]; // 0 - off, 1 - on, 2 - blue

            var count = 0;

            for (int i = 0; i < length; i++)
            {
                var current = light[i] - 1;

                status[current] = 1;
                if (current == 0 || (status[current - 1] == 2)) // mix i with current - take 10 minutes
                {
                    status[current] = 2;

                    //check right neighbors 
                    var index = current + 1; // mix i with current 
                    while (index < length && status[index] == 1)
                    {
                        status[index++] = 2;
                    }

                    if (index == (i + 1))
                    {
                        count++;
                    }
                }
            }

            return count; 
        }
    }
}