2019 - April
4/29
1035. Uncrossed Lines C# dynamic programming solution readable code
1034. Coloring A Border C# using two negative values to mark visited, -1 for the mark to change color
1033. Moving Stones Until Consecutive Ever tried. Ever failed. No matter. Try again
4/23
957. Prison Cells After N Days C# First practice in April 2019
4/22
75. Sort Colors C# Work on test case [2, 0, 1, 2] and then figure out the idea
1031. Maximum Sum of Two Non-Overlapping Subarrays Need to shorten the time
402. Remove K Digits C# easy to write using stack with analysis
402. Remove K Digits C# brute force solution - time consuming and struggling
4/15
1026. Maximum Difference Between Node and Ancestor code written in weekly contest
1025. Divisor Game C# recursive function practice after the weekly contest
1025. Divisor Game dynamic programming solution - Attention Please!
4/10
1024. Video Stitching C# greedy algorithm only one iteration on sorted array
4/18
1023. Camelcase Matching written in the contest 131
1023. Camelcase Matching solution learned after the contest
1022. Sum of Root To Leaf Binary Numbers C# a recursive function with module calculation
1021. Remove Outermost Parentheses
4/2
947. Most Stones Removed with Same Row or Column C# Use partial of union find algorithm to solve the problem
947. Most Stones Removed with Same Row or Column C# apply depth first search in a graph
947. Most Stones Removed with Same Row or Column weekly contest ranking 5, 8, 12, 13, 16, 40, 58, 117, 176 players - code study
947. Most Stones Removed with Same Row or Column union find algorithm study - rank, size, path compression, common mistakes, while/ recursive implementation
200. Number of Islands C# depth first search practice
From January 2015, she started to practice leetcode questions; she trains herself to stay focus, develops "muscle" memory when she practices those questions one by one. 2015年初, Julia开始参与做Leetcode, 开通自己第一个博客. 刷Leet code的题目, 她看了很多的代码, 每个人那学一点, 也开通Github, 发表自己的代码, 尝试写自己的一些体会. She learns from her favorite sports – tennis, 10,000 serves practice builds up good memory for a great serve. Just keep going. Hard work beats talent when talent fails to work hard.
Tuesday, May 28, 2019
2019 May algorithm practice
2019 - May
May 11
10. Regular Expression Matching C# one practice brought me back sweet story of practice in 2018
399. Evaluate Division Ask advice from the author - Amazon Senior SDE
399. Evaluate Division learn from C# code written in 2017
785 Is graph bipartite union find algorithm
785 Is graph bipartite depth first search algorithm
91. Decode Ways Code written in 2019
1037. Valid Boomerang 34 minutes for an easy algorithm
1038. Binary Search Tree to Greater Sum Tree how two small mistakes drag down my performance from 10 minutes to 50 minutes
1042. Flower Planting With No Adjacent code written in weekly contest
May 6 - 11
235. Lowest Common Ancestor of a Binary Tree binary search in BST
236. Lowest Common Ancestor of a Binary Search Tree time out using string, need help
236. Lowest Common Ancestor of a Binary Search Tree time out using list, need help
236. Lowest Common Ancestor of a Binary Search Tree optimal solution bottom up with reasoning
236. Lowest Common Ancestor of a Binary Search Tree various topics covered through 2019 practice
May 14
146. LRU Cache May 2019 pass 12/ 18 test cases
May 24
329. Longest Increasing Path in a Matrix C# depth first search and memoization classical algorithm
May 27
241 Different Ways To Add Parentheses practice in 2019 May - a Google interview algorithm
124. Binary Tree Maximum Path Sum 2019 May practice
May 11
10. Regular Expression Matching C# one practice brought me back sweet story of practice in 2018
399. Evaluate Division Ask advice from the author - Amazon Senior SDE
399. Evaluate Division learn from C# code written in 2017
785 Is graph bipartite union find algorithm
785 Is graph bipartite depth first search algorithm
91. Decode Ways Code written in 2019
1037. Valid Boomerang 34 minutes for an easy algorithm
1038. Binary Search Tree to Greater Sum Tree how two small mistakes drag down my performance from 10 minutes to 50 minutes
1042. Flower Planting With No Adjacent code written in weekly contest
May 6 - 11
235. Lowest Common Ancestor of a Binary Tree binary search in BST
236. Lowest Common Ancestor of a Binary Search Tree time out using string, need help
236. Lowest Common Ancestor of a Binary Search Tree time out using list, need help
236. Lowest Common Ancestor of a Binary Search Tree optimal solution bottom up with reasoning
236. Lowest Common Ancestor of a Binary Search Tree various topics covered through 2019 practice
May 14
146. LRU Cache May 2019 pass 12/ 18 test cases
May 24
329. Longest Increasing Path in a Matrix C# depth first search and memoization classical algorithm
May 27
241 Different Ways To Add Parentheses practice in 2019 May - a Google interview algorithm
124. Binary Tree Maximum Path Sum 2019 May practice
2019 algorithm practice
May 28, 2019
Introduction
It is time for me to get more organized on algorithm practice. I like to track how many algorithms I have practiced in 2019, and also what kind of mistakes I make etc. I need to separate page for 2019 practice
Github page
Here is my github page for 2019 practice.
I like to list all algorithms I practice in 2019. I need to constantly find new algorithms to work on, and also review my past practice as well.
I can easily find out what algorithms I solve by looking up my github page and sorting by the date time.
2019 - January
2019 - February
2019 - March
2019 - April
4/29
1035. Uncrossed Lines C# dynamic programming solution readable code
1034. Coloring A Border C# using two negative values to mark visited, -1 for the mark to change color
1033. Moving Stones Until Consecutive Ever tried. Ever failed. No matter. Try again
4/23
957. Prison Cells After N Days C# First practice in April 2019
4/22
75. Sort Colors C# Work on test case [2, 0, 1, 2] and then figure out the idea
1031. Maximum Sum of Two Non-Overlapping Subarrays Need to shorten the time
402. Remove K Digits C# easy to write using stack with analysis
402. Remove K Digits C# brute force solution - time consuming and struggling
4/15
1026. Maximum Difference Between Node and Ancestor code written in weekly contest
1025. Divisor Game C# recursive function practice after the weekly contest
1025. Divisor Game dynamic programming solution - Attention Please!
4/10
1024. Video Stitching C# greedy algorithm only one iteration on sorted array
4/18
1023. Camelcase Matching written in the contest 131
1023. Camelcase Matching solution learned after the contest
1022. Sum of Root To Leaf Binary Numbers C# a recursive function with module calculation
1021. Remove Outermost Parentheses
4/2
947. Most Stones Removed with Same Row or Column C# Use partial of union find algorithm to solve the problem
947. Most Stones Removed with Same Row or Column C# apply depth first search in a graph
947. Most Stones Removed with Same Row or Column weekly contest ranking 5, 8, 12, 13, 16, 40, 58, 117, 176 players - code study
947. Most Stones Removed with Same Row or Column union find algorithm study - rank, size, path compression, common mistakes, while/ recursive implementation
200. Number of Islands C# depth first search practice
2019 - February
2019 - March
2019 - April
4/29
1035. Uncrossed Lines C# dynamic programming solution readable code
1034. Coloring A Border C# using two negative values to mark visited, -1 for the mark to change color
1033. Moving Stones Until Consecutive Ever tried. Ever failed. No matter. Try again
4/23
957. Prison Cells After N Days C# First practice in April 2019
4/22
75. Sort Colors C# Work on test case [2, 0, 1, 2] and then figure out the idea
1031. Maximum Sum of Two Non-Overlapping Subarrays Need to shorten the time
402. Remove K Digits C# easy to write using stack with analysis
402. Remove K Digits C# brute force solution - time consuming and struggling
4/15
1026. Maximum Difference Between Node and Ancestor code written in weekly contest
1025. Divisor Game C# recursive function practice after the weekly contest
1025. Divisor Game dynamic programming solution - Attention Please!
4/10
1024. Video Stitching C# greedy algorithm only one iteration on sorted array
4/18
1023. Camelcase Matching written in the contest 131
1023. Camelcase Matching solution learned after the contest
1022. Sum of Root To Leaf Binary Numbers C# a recursive function with module calculation
1021. Remove Outermost Parentheses
4/2
947. Most Stones Removed with Same Row or Column C# Use partial of union find algorithm to solve the problem
947. Most Stones Removed with Same Row or Column C# apply depth first search in a graph
947. Most Stones Removed with Same Row or Column weekly contest ranking 5, 8, 12, 13, 16, 40, 58, 117, 176 players - code study
947. Most Stones Removed with Same Row or Column union find algorithm study - rank, size, path compression, common mistakes, while/ recursive implementation
200. Number of Islands C# depth first search practice
2019 - May
May 11
10. Regular Expression Matching C# one practice brought me back sweet story of practice in 2018
399. Evaluate Division Ask advice from the author - Amazon Senior SDE
399. Evaluate Division learn from C# code written in 2017
785 Is graph bipartite union find algorithm
785 Is graph bipartite depth first search algorithm
91. Decode Ways Code written in 2019
1037. Valid Boomerang 34 minutes for an easy algorithm
1038. Binary Search Tree to Greater Sum Tree how two small mistakes drag down my performance from 10 minutes to 50 minutes
1042. Flower Planting With No Adjacent code written in weekly contest
May 6 - 11
235. Lowest Common Ancestor of a Binary Tree binary search in BST
236. Lowest Common Ancestor of a Binary Search Tree time out using string, need help
236. Lowest Common Ancestor of a Binary Search Tree time out using list, need help
236. Lowest Common Ancestor of a Binary Search Tree optimal solution bottom up with reasoning
236. Lowest Common Ancestor of a Binary Search Tree various topics covered through 2019 practice
May 14
146. LRU Cache May 2019 pass 12/ 18 test cases
May 24
329. Longest Increasing Path in a Matrix C# depth first search and memoization classical algorithm
May 27
241 Different Ways To Add Parentheses practice in 2019 May - a Google interview algorithm
124. Binary Tree Maximum Path Sum 2019 May practice
May 11
10. Regular Expression Matching C# one practice brought me back sweet story of practice in 2018
399. Evaluate Division Ask advice from the author - Amazon Senior SDE
399. Evaluate Division learn from C# code written in 2017
785 Is graph bipartite union find algorithm
785 Is graph bipartite depth first search algorithm
91. Decode Ways Code written in 2019
1037. Valid Boomerang 34 minutes for an easy algorithm
1038. Binary Search Tree to Greater Sum Tree how two small mistakes drag down my performance from 10 minutes to 50 minutes
1042. Flower Planting With No Adjacent code written in weekly contest
May 6 - 11
235. Lowest Common Ancestor of a Binary Tree binary search in BST
236. Lowest Common Ancestor of a Binary Search Tree time out using string, need help
236. Lowest Common Ancestor of a Binary Search Tree time out using list, need help
236. Lowest Common Ancestor of a Binary Search Tree optimal solution bottom up with reasoning
236. Lowest Common Ancestor of a Binary Search Tree various topics covered through 2019 practice
May 14
146. LRU Cache May 2019 pass 12/ 18 test cases
May 24
329. Longest Increasing Path in a Matrix C# depth first search and memoization classical algorithm
May 27
241 Different Ways To Add Parentheses practice in 2019 May - a Google interview algorithm
124. Binary Tree Maximum Path Sum 2019 May practice
What Is a Robo-Advisor?
Here is the link.
The first big robo-advisor popped around the time of the Great Recession. Since then, hundreds more have opened. Betterment, which is one of the biggest robo-advisors, has assets under management that total about $10 billion. So what are these companies that people are now investing billions of dollars with?
The first big robo-advisor popped around the time of the Great Recession. Since then, hundreds more have opened. Betterment, which is one of the biggest robo-advisors, has assets under management that total about $10 billion. So what are these companies that people are now investing billions of dollars with?
TD Ameritrade Essential Portfolios Review
Here is the link.
In the past decade or so, robo-advisors have been taking business from traditional brokerages. In order to keep up, brokerages like TD Ameritrade have begun to offer automated portfolios that compete with robo-advisor services. Essential Portfolios is the automatically managed, online portfolio offering from TD Ameritrade. It is a relatively new service that’s still in development, but it is a solid choice for someone who wants fully automated portfolio. Looking for more than just an automated portfolio? TD Ameritrade offers other trading and investing options for competitive fees. You can also feel comfortable knowing that your money is being held by a reputable company.
TD Ameritrade Essential Portfolios is meant to give you a simple and affordable robo-advisor option. There is no cost to open an account and its mobile apps are also free. There is only one management fee of 0.30% no matter how much you invest. This fee is competitive with other brokers and robo-advisors. The minimum deposit for an account is $5,000. The ETFs in your account will charge you fees but their expense ratios are between 0.06% and 0.08%. That’s low. Many other robo-advisors have an average ETF expense ratio closer to 0.15%.
In the past decade or so, robo-advisors have been taking business from traditional brokerages. In order to keep up, brokerages like TD Ameritrade have begun to offer automated portfolios that compete with robo-advisor services. Essential Portfolios is the automatically managed, online portfolio offering from TD Ameritrade. It is a relatively new service that’s still in development, but it is a solid choice for someone who wants fully automated portfolio. Looking for more than just an automated portfolio? TD Ameritrade offers other trading and investing options for competitive fees. You can also feel comfortable knowing that your money is being held by a reputable company.
TD Ameritrade Essential Portfolios is meant to give you a simple and affordable robo-advisor option. There is no cost to open an account and its mobile apps are also free. There is only one management fee of 0.30% no matter how much you invest. This fee is competitive with other brokers and robo-advisors. The minimum deposit for an account is $5,000. The ETFs in your account will charge you fees but their expense ratios are between 0.06% and 0.08%. That’s low. Many other robo-advisors have an average ETF expense ratio closer to 0.15%.
Monday, May 27, 2019
Put all cash into BND ETF first
May 27, 2019
It is my personal finance research. I am a self-learner and I start to watch more CNBC about investment. I could not make decision what to purchase and setup portfolio in less than one week or two. Now it is almost the end of May 2019.
One idea is to put all cash into BND ETF first. And I take some time to figure out how to put together a portfolio.
Introduction
It is my personal finance research. I am a self-learner and I start to watch more CNBC about investment. I could not make decision what to purchase and setup portfolio in less than one week or two. Now it is almost the end of May 2019.
One idea
One idea is to put all cash into BND ETF first. And I take some time to figure out how to put together a portfolio.
Where I am in terms of algorithm problem solving?
May 27, 2019
It is very important for me to train myself every day one hour or two hour to go over 10 algorithms, and I have to push myself think about how to solve those algorithms with optimal solution. Maybe I should try 20 next, 30 next, 40 next, 50 next. I like to train myself to think about ideas.
I do not know where I am in terms of problem solving skills. I wrote a post to document my pyschology problem in the contest under stress, I should focus on more reasoning, and also avoid common mistakes. And also I learn from mock interviews as an interviewer, I should continue to learn one algorithm until I can master various solutions to solve the algorithm. I did work on lowest common ancestor 236 and wrote a series of topics based on my practice.
I think that it should become normal daily practice for me to work on a few algorithms a day, I should keep in mind that the algorithm problem solving is ongoing process; I should not depend on luck. First of all, I should solve 20 to 30 algorithms a week. I should learn what is complicated solution to write, and then avoid writing tough and complicated solution if I have choice.
It is so much fun to learn what I can do or cannot do in terms of problem solving.
Introduction
It is very important for me to train myself every day one hour or two hour to go over 10 algorithms, and I have to push myself think about how to solve those algorithms with optimal solution. Maybe I should try 20 next, 30 next, 40 next, 50 next. I like to train myself to think about ideas.
Where am I?
I do not know where I am in terms of problem solving skills. I wrote a post to document my pyschology problem in the contest under stress, I should focus on more reasoning, and also avoid common mistakes. And also I learn from mock interviews as an interviewer, I should continue to learn one algorithm until I can master various solutions to solve the algorithm. I did work on lowest common ancestor 236 and wrote a series of topics based on my practice.
I think that it should become normal daily practice for me to work on a few algorithms a day, I should keep in mind that the algorithm problem solving is ongoing process; I should not depend on luck. First of all, I should solve 20 to 30 algorithms a week. I should learn what is complicated solution to write, and then avoid writing tough and complicated solution if I have choice.
It is so much fun to learn what I can do or cannot do in terms of problem solving.
Case study: mock interview is graph bipartite?
May 27, 2019
I like to write a case study on today's mock interview on algorithm: is graph bipartite?
Interviewee feedback
Interviewer feedback
I like to write a case study on today's mock interview on algorithm: is graph bipartite?
Interviewee feedback
Interviewer feedback
124. Binary Tree Maximum Path Sum
May 27, 2019
It is one of algorithms I came cross. I like to practice again. One of ideas is to traverse the tree using post order traversal, and then design a recursive function to return maximum path from root to leaf node, and then add some additional task in the recursive function
I like to share my practice on Leetcode.com discuss. Here is the link.
Introduction
It is one of algorithms I came cross. I like to practice again. One of ideas is to traverse the tree using post order traversal, and then design a recursive function to return maximum path from root to leaf node, and then add some additional task in the recursive function
My practice
I like to share my practice on Leetcode.com discuss. Here is the link.
241. Different Ways to Add Parentheses
Here is my discussion post.
It is a medium level algorithm. I came cross the algorithm since I read the article about one Google onsite in 2019. This algorithm is one of interview algorithms.
Here are the highlights of my practice in May 2019:
- Base case, make it clear and also the position is at the very beginning - input is an integer; otherwise the whole list is empty.
- Brute force solution, the idea is any operator in the expression can be the last one to be calculated. In other words, expression is constructed as "part1 + operator + part2" whereas part1 and part2 are the subproblems.
- Apply memoization to avoid redundant calculation - if there is time.
- Extra note on step 2, work on test case "1+2", and make sure that part1 and part2 are correct. Detail see comment
Time complexity
It is expontial time complexity since any of operators can be the last one, so the total options will be N!, N is total operators.
It is also very interesting to review my practices in 2015 and 2016. I have to push myself to practice more solutions on this problem in 2019.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _241_different_way_to_add_parenthesis
{
class Program
{
static void Main(string[] args)
{
RunTestcase1();
}
public static void RunTestcase1()
{
var result = DiffWaysToCompute("2-1-1");
}
public static Dictionary<string, IList<int>> map = new Dictionary<string, IList<int>>();
/// <summary>
/// May 27, 2019
/// study code
/// https://leetcode.com/problems/different-ways-to-add-parentheses/discuss/66328/A-recursive-Java-solution-(284-ms)/179202
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static IList<int> DiffWaysToCompute(string input)
{
if (map.ContainsKey(input))
{
return map[input];
}
var results = new List<int>();
// base case - input is an integer
if (!(input.Contains("+") || input.Contains("-") || input.Contains("*")))
{
results.Add(Convert.ToInt32(input));
}
// brute force solution - go over each operator in the expression
for (int i = 0; i < input.Length; i++)
{
var current = input[i];
var isOperator = "+-*".IndexOf(current) != -1;
if (!isOperator)
continue;
/*
* 1 + 2
* part1 "1"
* part2 "2"
* '+' will not be counted by part1 or part2
*/
var part1 = input.Substring(0, i);
var part2 = input.Substring(i + 1); // bug fix, i + 1 instead of i
var list1 = DiffWaysToCompute(part1);
var list2 = DiffWaysToCompute(part2);
foreach (var item1 in list1)
{
foreach (var item2 in list2)
{
int calculated = 0;
if (current == '+')
{
calculated = item1 + item2;
}
else if (current == '-')
{
calculated = item1 - item2;
}
else if (current == '*')
{
calculated = item1 * item2;
}
results.Add(calculated);
}
}
}
map.Add(input, results);
return results;
}
}
}
Actionable Items
I am so glad to review my practice in 2015 and 2018. I can tell some difference based on the practice compared to a few years ago.
Sunday, May 26, 2019
Here's why traders think everything is awesome again as we head into earnings season
Here is the link.
It is my job to push myself to learn and then I can understand what they are talking about.
It is my job to push myself to learn and then I can understand what they are talking about.
S&P 500 Information Technology Sector Index
May 26, 2019
It is my personal finance research. I already work on the research over eight months, but I still need to push myself to learn more before I put all my cash asset into stock by building a portfolio with growth fund. I like to look into information technology sector and its index.
Here is the page to read.
Introduction
It is my personal finance research. I already work on the research over eight months, but I still need to push myself to learn more before I put all my cash asset into stock by building a portfolio with growth fund. I like to look into information technology sector and its index.
30 minutes study
Here is the page to read.
Guy Adami Director of Advisor Advocacy, Private Advisor Group
Guy is an original member of CNBC's Fast Money. He is currently the Director of Advisor Advocacy at Private Advisor Group in Morristown, New Jersey. Private Advisor Group is comprised of a network of nearly 600 advisors with assets approaching $17B.
Guy has held numerous key leadership roles in the financial services industry. He began his career at Drexel Burnham Lambert in 1986 and was quickly promoted to Vice President and head gold trader at the firm. In 1996, he joined Goldman Sachs as their head gold trader and one of the many proprietary traders within the Fixed Income Currency and Commodity division. In the spring of 2000, Adami joined the U.S. Equities division of Goldman Sachs where he was put in charge of the firm's Industrial/Basic Material group.
Dan Nathan Principal, RiskReversal Advisors
Here is the profile page.
Dan is the principal of RiskReversal Advisors. Founded in 2016,RiskReversal Advisors offers consulting services to investment banks, investment advisors,and private companies.
Dan has spent the better part of the last 20 years as a proprietary equity & options trader at hedge funds (SAC,Exis and Cheyne Capital) and within the equity derivatives group of Merrill Lynch. From 2009 to 2016 Dan served as an intermediary to investment banks for large equity option block trades while also offering trade structure ideas to investment advisors.
In 2011, Dan co-founded RiskReversal.com, a service dedicated to educating equity investors to the alternative ways to express their views in the public markets,by detailing the uses of equity options to better define risk, enhance yield and make use of leverage in a cost-effective manner.
Timothy Seymour CIO, Seymour Asset Management
Here is the profile page.
Tim Seymour is founder and Chief Investment Officer of Seymour Asset Management(SAM). SAM provides both asset management and wealth management services for its clients, including direct investment and allocation to private equity and alternative assets.
Tim has over 22 years of investment experience as a portfolio manager, allocator and capital markets professional across multiple asset classes. He also looks at the impact of cyber risks on the global economy. Tim is a recognized voice within the investment community as a trader and market strategist on CNBC. For the past decade,Tim has been a primary investor voice on Fast Money. Tim is often cited as one of the top finance professionals on Twitter, including The Wall Street Journal's "Top Tweets For Your Money".
Case study: Chat with my ex-coach on wechat.com
May 26, 2019
It is important to invest some time to get connected to friends, ex-coach as well. After almost one year, I chatted with my ex-coach on wechat again. He is working for Indeed.com. I have to get some advice on how to push myself to complete more algorithms on leetcode.com.
It is time consuming to type on cellular phone. I should have typed on my computer instead. A few words a few minutes, but it took us more than one hour.
I like to document my chat to remove confidential information. And then I like to document how much time I actually spent on this chat.
Introduction
It is important to invest some time to get connected to friends, ex-coach as well. After almost one year, I chatted with my ex-coach on wechat again. He is working for Indeed.com. I have to get some advice on how to push myself to complete more algorithms on leetcode.com.
Case study
It is time consuming to type on cellular phone. I should have typed on my computer instead. A few words a few minutes, but it took us more than one hour.
I like to document my chat to remove confidential information. And then I like to document how much time I actually spent on this chat.
Technician: Hot tech rally about to cool off but there's still one name to buy
Here is the link.
It is tough for me to make decision how to invest those asset into stock market. I like to push myself learn more, be patient. One of ideas is to start to watch the videos from CNBC.
It is tough for me to make decision how to invest those asset into stock market. I like to push myself learn more, be patient. One of ideas is to start to watch the videos from CNBC.
Saturday, May 25, 2019
Subscribe to:
Posts (Atom)











