July 16, 2017
Plan to study the algorithm called minimum spanning tree. The problem statement is written in Chinese like the following:
给十几个城市供电,连接不同城市的花费不同,让花费最小同时连到所有的边。给出一系列connection类,里面是edge两端的城市名和它们之间的一个cost,找出要你挑一些边,把所有城市连接起来并且总花费最小。不能有环,最后所以城市要连成一个连通块。
不能的话输出空表,最后还要按城市名字排序输出,按照node1来排序,如果一样的话再排node2。
输入:
{“Acity”,”Bcity”,1}
(“Acity”,”Ccity”,2}
(“Bcity”,”Ccity”,3}
输出:
(“Acity”,”Bcity”,1}
(“Acity”,”Ccity”,2}
补充一句,test case一共有6个。
Plan to study Java code implementation. The link is here.
Write C# code based on the above Java implementation. The code has run time error. Code is here.
Review Kruskal algorithm to implement the minimum spanning tree. The past practice is documented in the blog.
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.
Sunday, July 16, 2017
Leetcode 207 - Course Schedule
July 16, 2017
Plan to study Leetcode 207 course schedule again. Read a few solution through leetcode discussion first.
Plan to study Java code. The link is here.
Plan to study Leetcode 207 course schedule again. Read a few solution through leetcode discussion first.
Plan to study Java code. The link is here.
Order Dependency II
July 16, 2017
Plan to study the algorithm again.
It is the great to talk about the algorithm - topological sorting.
How to detect if there is a cycle in directed graph.
Using coloring to determine if there is a loop. Read the introduction of algorithm to figure out.
3 color scheme: white, gray, black
white - the node has not been visited before
gray - the node is visited by DFS search
black - it is visited before, and DFS is completed?
The basic idea is to visit white node using DFS, visit the white node and then mark it to be gray color. If the visit node is black, do not continue. However, it is a gray node, that means the loop is existing because it is second time to visit the same node.
If there is no loop in the graph, all nodes will be marked in black color.
Detail please read the blog written in Chinese, link is here.
Plan to study Java code implementation first. The study code is here.
Plan to study the algorithm again.
It is the great to talk about the algorithm - topological sorting.
How to detect if there is a cycle in directed graph.
Using coloring to determine if there is a loop. Read the introduction of algorithm to figure out.
3 color scheme: white, gray, black
white - the node has not been visited before
gray - the node is visited by DFS search
black - it is visited before, and DFS is completed?
The basic idea is to visit white node using DFS, visit the white node and then mark it to be gray color. If the visit node is black, do not continue. However, it is a gray node, that means the loop is existing because it is second time to visit the same node.
If there is no loop in the graph, all nodes will be marked in black color.
Detail please read the blog written in Chinese, link is here.
Plan to study Java code implementation first. The study code is here.
Order dependency (I)
Rotate matrix
July 16, 2017
把一个m*n的矩阵旋转90度,给一个flag规定是向左转还是向右转。
Plan to study code written in Java. The link is here.
input
1 2 3
4 5 6
7 8 9
output1
3 6 9
2 5 8
1 4 7
output2
7 4 1
8 5 2
9 6 3
把一个m*n的矩阵旋转90度,给一个flag规定是向左转还是向右转。
Plan to study code written in Java. The link is here.
input
1 2 3
4 5 6
7 8 9
output1
3 6 9
2 5 8
1 4 7
output2
7 4 1
8 5 2
9 6 3
Round Robin algorithm
July 17, 2017
一个处理器要处理一堆request,一次只能处理一条,每次执行一个任务最多执行时间q,接着执行等待着的下一个任务。若前一个任务没执行完则放到队尾,等待下一次执行。
假设只要有任务开始以后cpu是不会空闲的,也就是说cpu开始后如果空闲了就说明没有任务了,另外Robin Round最后返回值是float。
Java code is here to study.
一个处理器要处理一堆request,一次只能处理一条,每次执行一个任务最多执行时间q,接着执行等待着的下一个任务。若前一个任务没执行完则放到队尾,等待下一次执行。
假设只要有任务开始以后cpu是不会空闲的,也就是说cpu开始后如果空闲了就说明没有任务了,另外Robin Round最后返回值是float。
Java code is here to study.
Tree Amplitude
July 16, 2017
Tree Amplitude
In a binary tree T, a path P is a non-empty sequence of nodes of tree such that, each consecutive node in the sequence is a subtree of its preceding node. In the example tree, the sequences [9, 8, 2] and [5, 8, 12] are two paths, while [12, 8, 2] is not. The amplitude of path P is the maximum difference among values of nodes on path P. The amplitude of tree T is the maximum amplitude of all paths in T. When the tree is empty, it contains no path, and its amplitude is treated as 0.For exmaple.
Input:
5
/ \
8 9
/ \ / \
12 2 8 4
/ /
2 5
Output:
7
Explanation:
The paths [5, 8, 12] and [9, 8, 2] have the maximum amplitude 7.
Code:
public static int amplitude(TreeNode root) is answer, others are helper functions for testing.
7
Explanation:
The paths [5, 8, 12] and [9, 8, 2] have the maximum amplitude 7.
Code:
public static int amplitude(TreeNode root) is answer, others are helper functions for testing.
Java code is here to study.
K closest points
July 16, 2017
K Closest Points
Problem:
Find the K closest points to the origin in 2D plane, given an array containing N points. You can assume K is much smaller than N and N is very large. You need only use standard math operators (addition, subtraction, multiplication, and division).
Code:
Study code: Java code is here.
Plan to review C# practice using SortedSet and ICompare first, and then write a C# code for this K closest points.
K Closest Points
Problem:
Find the K closest points to the origin in 2D plane, given an array containing N points. You can assume K is much smaller than N and N is very large. You need only use standard math operators (addition, subtraction, multiplication, and division).
Code:
Study code: Java code is here.
Plan to review C# practice using SortedSet and ICompare first, and then write a C# code for this K closest points.
Saturday, July 15, 2017
Coding challenge
July 15, 2017
It is very challenge task to compete in less than three hours contest. Specially hour rank on Hackerrank. Julia did a few of Leetcode weekly contests, one algorithm Leetcode 605: Can plant flower, one time she spent over 30 minutes on easy algorithm, but she learned to write a solution after the contest in less than 10 minutes.
How to prepare a coding assessment challenge? How to review Leetcode algorithms? How to warm up a few hours before taking the test?
July 20, 2017
It is important to work on a few algorithms, write some blogs, and document real learning experience. Julia enjoys the algorithm problem solving, she also noticed that she should take some time to review what she learned last 3 months.
Julia spent one week to prepare, she did study a few algorithms and enjoyed most of them. The best one is to work on the algorithm called maze. The idea is to work on simple things, implementation, time to complete the coding, comparison among various solutions, learn to write a quick and complete solution in less than 5 minutes.
She spent last 3 hours to print out all source code she worked on Leetcode last 3 months, almost 30 algorithm. She reviewed all of them one by one, spent a few minutes on each of them. She was so touched by her hard work, she did learn a few things through those practice.
So when she started to work on code challenge, she was very calm. She shifted her focus on things she could control. She felt that she was mature enough for another assessment, since she reviewed and also learned something new. She likes to check honestly if she can handle challenge, solve problems.
Introduction
It is very challenge task to compete in less than three hours contest. Specially hour rank on Hackerrank. Julia did a few of Leetcode weekly contests, one algorithm Leetcode 605: Can plant flower, one time she spent over 30 minutes on easy algorithm, but she learned to write a solution after the contest in less than 10 minutes.
How to prepare a coding assessment challenge? How to review Leetcode algorithms? How to warm up a few hours before taking the test?
Challenge
It is important to work on a few algorithms, write some blogs, and document real learning experience. Julia enjoys the algorithm problem solving, she also noticed that she should take some time to review what she learned last 3 months.
Julia spent one week to prepare, she did study a few algorithms and enjoyed most of them. The best one is to work on the algorithm called maze. The idea is to work on simple things, implementation, time to complete the coding, comparison among various solutions, learn to write a quick and complete solution in less than 5 minutes.
She spent last 3 hours to print out all source code she worked on Leetcode last 3 months, almost 30 algorithm. She reviewed all of them one by one, spent a few minutes on each of them. She was so touched by her hard work, she did learn a few things through those practice.
So when she started to work on code challenge, she was very calm. She shifted her focus on things she could control. She felt that she was mature enough for another assessment, since she reviewed and also learned something new. She likes to check honestly if she can handle challenge, solve problems.
Sponsor application project
July 15, 2017
To be a competitive programmer, Julia has to train herself plan her time very well. Disciple herself, relax herself, and work efficiently with her limited time and resource.
One of the ideas is to do it yourself. What she has to do is to learn the project she works on. No matter what project is, even if it is not related to the software programming. Julia likes her to learn as a beginner, and then take the risk, work on it 30 minutes a time, one hour a time.
Think about this way, in order to make $3000 net profit at minimum wage job, Julia has to put 300 hours labors, and then she has to spend time on the road to get the place, back and forth, not counting time to prepare meal for the work.
This sponsor application project will be taken by a professional immigration consultant if Julia likes to pay $3000.00 dollar. Therefore, Julia has to work on the case more, invest more time, and get more update with the others.
Now it is 11:09 am, Julia likes to take two hours to work on the case.
Introduction
To be a competitive programmer, Julia has to train herself plan her time very well. Disciple herself, relax herself, and work efficiently with her limited time and resource.
One of the ideas is to do it yourself. What she has to do is to learn the project she works on. No matter what project is, even if it is not related to the software programming. Julia likes her to learn as a beginner, and then take the risk, work on it 30 minutes a time, one hour a time.
Think about this way, in order to make $3000 net profit at minimum wage job, Julia has to put 300 hours labors, and then she has to spend time on the road to get the place, back and forth, not counting time to prepare meal for the work.
This sponsor application project will be taken by a professional immigration consultant if Julia likes to pay $3000.00 dollar. Therefore, Julia has to work on the case more, invest more time, and get more update with the others.
Now it is 11:09 am, Julia likes to take two hours to work on the case.
Sponsor application project
Friday, July 14, 2017
Leetcode 130: Surrounded Regions
July 14, 2017
Surrounded regions algorithm is very good depth first search algorithm to practice. Here is the C# practice Julia did.
Thursday, July 13, 2017
Can I be a data scientist?
July 13, 2017
It is a good research topic for Julia to work on. Can I be a data scientist? Julia works on the small manufacture company over seven years, and she works on the sales, accounting analysis and then she felt so much confident to play with the data. She likes to look into the area she should work on in order to be a data scientist.
Should I learn a new language used by data scientist? Can I create a big impact if I know data science very well. What courses should Julia look into?
Julia worked on a lot of algorithm on hackerrank contests, she had difficult time to work on those advanced algorithm, huge data, she did not have time to play with those data set. She tried to stay on basics, and work on the advanced algorithm or data structure, focus on mathematics instead.
Her experience of over 18 contests tells her something. The data science is nothing new. As bible said, Ecclesiastes 1:9
What has been will be again,
what has been done will be done again;
there is nothing new under the sun.
Julia, stay focus and work on the foundation of computer science.
Introduction
It is a good research topic for Julia to work on. Can I be a data scientist? Julia works on the small manufacture company over seven years, and she works on the sales, accounting analysis and then she felt so much confident to play with the data. She likes to look into the area she should work on in order to be a data scientist.
Should I learn a new language used by data scientist? Can I create a big impact if I know data science very well. What courses should Julia look into?
Julia worked on a lot of algorithm on hackerrank contests, she had difficult time to work on those advanced algorithm, huge data, she did not have time to play with those data set. She tried to stay on basics, and work on the advanced algorithm or data structure, focus on mathematics instead.
Her experience of over 18 contests tells her something. The data science is nothing new. As bible said, Ecclesiastes 1:9
What has been will be again,
what has been done will be done again;
there is nothing new under the sun.
Julia, stay focus and work on the foundation of computer science.
WTA No. 1 - Karolina Pliskova
July 13, 2017
It takes 90 minutes to go over the twitter account of WTA No. 1 - Karolina Pliskova, and Julia started to watch around 12:00 am and she finished around 1:30 am on July 11, 2017. And she did in Tuesday, and she sacrificed some sleep and she had to get up for work around 8:00 am.
It takes some time to figure out how ranking works in WTA. Here is the video to show progress of ranking with points - Karolina Pliskova.
2016 Cincinnati champion +900
2016 US Open Finalist +1300
2016 WTA Finals Qualifier +500
2017 Brisbane Champion +470
2017 Doha Champion +470
2017 Indian Wells Semifinalist +390
2017 Miami Semifinalist +390
2017 French Open Seminfinalist +780
2017 Eastbourn Champion +470
Julia likes to play tennis, and she met so many top players in China last October. She likes to learn how professional players handle pressure, train themselves.
Know one player a time. It is such great time to learn a new No. 1 player.
Julia also spent over 15 minutes to study No. 1 website, figure out if the design is good one or can be better based on her experience.
It takes 90 minutes to go over the twitter account of WTA No. 1 - Karolina Pliskova, and Julia started to watch around 12:00 am and she finished around 1:30 am on July 11, 2017. And she did in Tuesday, and she sacrificed some sleep and she had to get up for work around 8:00 am.
It takes some time to figure out how ranking works in WTA. Here is the video to show progress of ranking with points - Karolina Pliskova.
2016 Cincinnati champion +900
2016 US Open Finalist +1300
2016 WTA Finals Qualifier +500
2017 Brisbane Champion +470
2017 Doha Champion +470
2017 Indian Wells Semifinalist +390
2017 Miami Semifinalist +390
2017 French Open Seminfinalist +780
2017 Eastbourn Champion +470
Julia likes to play tennis, and she met so many top players in China last October. She likes to learn how professional players handle pressure, train themselves.
Know one player a time. It is such great time to learn a new No. 1 player.
Julia also spent over 15 minutes to study No. 1 website, figure out if the design is good one or can be better based on her experience.
Difference talk between two algorithms: Leetcode 200 and Leetcode 547
July 13, 2017
It is interesting to look into two algorithms: Leetcode 200 and Leetcode 547, what is the difference?
Julia likes to answer the question and see if she can find something to work on later.
The depth first search using recursive function, check deadloop, mark visited node, it is always most short and quick solution.
Introduction
It is interesting to look into two algorithms: Leetcode 200 and Leetcode 547, what is the difference?
Julia likes to answer the question and see if she can find something to work on later.
The depth first search using recursive function, check deadloop, mark visited node, it is always most short and quick solution.
Tuesday, July 11, 2017
Sponsor application project
July 11, 2017
It is the interesting journey to file a sponsor application project as a Canadian citizen. It is a lot of work and take some planning.
It is getting better to work on paper work preparation. But it takes some time to get more familiar with the process of the application.
Julia decided to file the sponsor application herself one week ago. Since she started the project last July, Julia knew that the most important thing is to prepare early and work hard to learn the process. Almost 12 months passed, Julia decided to stay focus on the task one or 2 weeks, stop working on algorithm practice, mocking interview, and then spent more time on her application.
Being a competitive programmer, there are a lot of things to learn. It cannot be finished in one or two weeks.
Her favorite philosophy is so surprising to match the following reading she had recently. She likes to share here and it may bring some good thoughts for future work. Why a software programmer should consider cooking at home?
From the article: Cooking At Home.
Back to 1999, she only has 2 miles to drive to work, she bought a brand new car, sports utilities vehicle, even though Florida is such a flat terrain area to drive, and it is on the credit, a factory loan from Ford company. And she bought a 3 years Bally gym contract, she only showed up less than 20 times in 3 years. One time she got 20 dollars class inside the gym.
Back to 2008, She did take three time IELTS tests in 2008 in order to meet Canada immigration minimum score. She did 3 times in a row in 3 months time range and she achieved her goal. And six month later she got denial application result, then she started to appeal case over 10 months from January to October 2009, she did almost flunk her appeal against Canadian Federal court even though she did everything by herself, but she won the judge approval for a court date in June 2009.
Back to 2009, Julia got an offer to pay 1000 dollars and the immigration lawyer will write a letter for her to the immigration department to appeal her denial of decision in January 2009. Julia decided to write a letter by herself, and filed an appeal case by herself in 60 days after the denial. She worked on the appeal for leave more than 10 months, and got settle offer in Sept. 2009. It is a miracle that Julia did not go to the court and settle down outside the court. The statistics shows that 90% of case settles outside the court.
Through the immigration lawsuit, Julia knew how important it is to work with people very carefully, and gain the trust and support from the people. First time she understood that how important a judge can make a difference in her life. The Canadian immigration judge gave her a chance to go to the court even though she just learned to file the lawsuit document by herself, she studied over 20 immigration lawyers website, case studies. She tried to write down notes to help her to find laws, facts, where are the good arguments. It was so much fun to work on her own case through those months, she learned the first time she had to write document each step, and stayed focus on each step.
She understood that it is most important thing in the life called immigration, and it is very important to study every detail by herself even if she decides to ask the help from the full time consultant.
In 2017, Julia chose to work for herself instead of using licensed immigration consultant for sponsor application.
Best teacher is to learn your own mistake, experience failures, she likes to get the application file again as soon as possible. And also she likes to write down her process, so she can overcome her procrastination problem, learn how to get into the zone of filing, and preparing process.
Julia wrote a blog on July 1 Canada day, and then shifted her focus on the sponsor application instead of Hackerrank contests, and Leetcode algorithms, and mocking interviews after work and weekends. Being a responsible person, make a plan, and follow through the plan. That makes a person success, it does not matter if the project is algorithm and data structure practice, or other thing like sponsor application.
Introduction
It is the interesting journey to file a sponsor application project as a Canadian citizen. It is a lot of work and take some planning.
It is getting better to work on paper work preparation. But it takes some time to get more familiar with the process of the application.
Julia decided to file the sponsor application herself one week ago. Since she started the project last July, Julia knew that the most important thing is to prepare early and work hard to learn the process. Almost 12 months passed, Julia decided to stay focus on the task one or 2 weeks, stop working on algorithm practice, mocking interview, and then spent more time on her application.
Being a competitive programmer, there are a lot of things to learn. It cannot be finished in one or two weeks.
Her favorite philosophy is so surprising to match the following reading she had recently. She likes to share here and it may bring some good thoughts for future work. Why a software programmer should consider cooking at home?
From the article: Cooking At Home.
If weight loss is your goal, you’ll get better results by simply cooking everything at home and counting your calories. Exercise is great too, but it’s not nearly as effective as diet.
America is this bizarre place where everything we do seems to get filtered through some corporate entity that charges a convenience fee. Over the course of a lifetime, those convenience fees add up and result in each us spending more of our lives mandatory working for someone else.
We want a refreshing drink, so we buy a Coca Cola. But Coke has sugar and calories that make us fat, so we decide to get a gym membership to burn them off. Then we decide we need a nice new car to get to the gym, which adds all sorts of fees and insurance. It’s even worse if we decide to buy that car on credit — many of us do!
Most of our problems stem from a few simple choices. Those choices create a vicious cycle of consumption that forces us to spend our lives on things that don’t matter.
What happens if we drink water instead? What if we go on a run outside, or buy a cheap set of weights? What if we decide to walk more places instead of driving?
This is an article about cooking, but it might as well be an article about taking more control of your life in general.
A smart programmer learns to write great code, but she likes to learn basics as well. Like cooking at home, and sports. She likes to learn to write down her lessons one a time, she likes to break a vicious cycle starting from 17 years ago.Lessons learned
Back to 1999, she only has 2 miles to drive to work, she bought a brand new car, sports utilities vehicle, even though Florida is such a flat terrain area to drive, and it is on the credit, a factory loan from Ford company. And she bought a 3 years Bally gym contract, she only showed up less than 20 times in 3 years. One time she got 20 dollars class inside the gym.
Back to 2008, She did take three time IELTS tests in 2008 in order to meet Canada immigration minimum score. She did 3 times in a row in 3 months time range and she achieved her goal. And six month later she got denial application result, then she started to appeal case over 10 months from January to October 2009, she did almost flunk her appeal against Canadian Federal court even though she did everything by herself, but she won the judge approval for a court date in June 2009.
Back to 2009, Julia got an offer to pay 1000 dollars and the immigration lawyer will write a letter for her to the immigration department to appeal her denial of decision in January 2009. Julia decided to write a letter by herself, and filed an appeal case by herself in 60 days after the denial. She worked on the appeal for leave more than 10 months, and got settle offer in Sept. 2009. It is a miracle that Julia did not go to the court and settle down outside the court. The statistics shows that 90% of case settles outside the court.
Through the immigration lawsuit, Julia knew how important it is to work with people very carefully, and gain the trust and support from the people. First time she understood that how important a judge can make a difference in her life. The Canadian immigration judge gave her a chance to go to the court even though she just learned to file the lawsuit document by herself, she studied over 20 immigration lawyers website, case studies. She tried to write down notes to help her to find laws, facts, where are the good arguments. It was so much fun to work on her own case through those months, she learned the first time she had to write document each step, and stayed focus on each step.
She understood that it is most important thing in the life called immigration, and it is very important to study every detail by herself even if she decides to ask the help from the full time consultant.
In 2017, Julia chose to work for herself instead of using licensed immigration consultant for sponsor application.
Best teacher is to learn your own mistake, experience failures, she likes to get the application file again as soon as possible. And also she likes to write down her process, so she can overcome her procrastination problem, learn how to get into the zone of filing, and preparing process.
Julia wrote a blog on July 1 Canada day, and then shifted her focus on the sponsor application instead of Hackerrank contests, and Leetcode algorithms, and mocking interviews after work and weekends. Being a responsible person, make a plan, and follow through the plan. That makes a person success, it does not matter if the project is algorithm and data structure practice, or other thing like sponsor application.
Leetcode 547: Friends Circle
July 11, 2017
Plan to work on Leetcode 547: Friends Circle. The problem statement is here.
C# practice using depth first search is here.
JavaScript study code is here.
It took Julia over 20 minutes to think about this medium algorithm. One thing Julia likes to do is to study over 10 implementations, and then write them using C# one by one. And also try to figure out the best way to identify the problem as a depth first search algorithm, and separate from advanced algorithm, time-consuming implementation.
Learn a few ideas of classical algorithm implementation, like disjoint set, union find algorithm. Review the past practice as well.
Study one of C++ solution, the link is here.
Write C# solution - link is here.
Disjoint set implementation in C#, link is here.
Plan to work on Leetcode 547: Friends Circle. The problem statement is here.
C# practice using depth first search is here.
JavaScript study code is here.
Algorithm talk
It took Julia over 20 minutes to think about this medium algorithm. One thing Julia likes to do is to study over 10 implementations, and then write them using C# one by one. And also try to figure out the best way to identify the problem as a depth first search algorithm, and separate from advanced algorithm, time-consuming implementation.
Learn a few ideas of classical algorithm implementation, like disjoint set, union find algorithm. Review the past practice as well.
Study one of C++ solution, the link is here.
Write C# solution - link is here.
Disjoint set implementation in C#, link is here.
Leetcode 200: Number of Islands
July 11, 2017
Plan to study Leetcode 200.
Plan to go over union find alogorithm on this discussion link.
Plan to study Leetcode 200.
Plan to go over union find alogorithm on this discussion link.
Leetcode 49: Group Anagrams
July 11, 2017
Group anagrams is Julia's favorite algorithm 5 months ago. Julia asked the question on the code review site, here is the link. So far, there are only 102 views. Here is the coding blog about the practice on Feb. 4, 2017.
Plan to go through the discussion of Leetcode 49 group anagrams algorithm. It is the great learning experience to go over difference ideas, and practice one by one using C# programming language.
Introduction
Plan to go through the discussion of Leetcode 49 group anagrams algorithm. It is the great learning experience to go over difference ideas, and practice one by one using C# programming language.
Algorithm study
Here is one of the C# practice. The idea is very simple, sorting the char array so that the anagram string can match the key of hash table.
Sunday, July 9, 2017
Am I good programmer?
July 9, 2017
It is exciting to spend 30 minutes to do some research at the night of Sunday. The topic Julia chose is "Am I a good programmer?". Julia likes to be very competitive hackerrank contest player, good at computer algorithm and data structure. But also Julia likes to be a leader, enjoy the journey by sharing her struggle, learning process of hard topic on algorithm, data structure. How does she advance herself as a software programmer, learning as a system designer, and she also likes to pick up other skills. Like good humour, strong and healthy physical body and strong mental toughness, and good sense of humour, master a sports - tennis.
Julia made a few choices, chose to work on Leetcode algorithms, work on the coding blog, work on code review, Leetcode discussion.
It is hard work to reinvent myself as a software programmer. Julia spends last 3 months to meet people and conduct mocking interview, in her career as a full time programmer last 7 year, it is the first time she starts to learn how to work with a peer through 60 minutes time range. She wrote a blog about common mistakes in mocking.
Last weekend Julia spent more than three hours to watch the show on netflix called Quantico, the actress Priyanka has more than 17.9M followers on twitter. Julia likes to spend some time to read how the actress develops skills and build a good connection with peers. The actor Jake wiki page is here.
Coding, learning algorithm, reading and also mocking, Julia starts to get good habit to practice daily. But it is better to take Sunday off . Say no to algorithm and data structure, mocking interviews on Sunday, learn to relax more in the summer. Also Julia has to spend time to work on the sponsor application project.
Julia still calculates how much time she spends on the internet in the week days, she did waste a lot of hours. Instead she should plan better to work on more meaningful activities, like attending Sunday church service, get connected to friends and family, play more sports like tennis single matches, make life more fun and exciting.
It is the great experience to serve 8000 views last month. Most of time the blog serves Julia very well, she has chance to keep tracking of her progress on algorithm and data structure, and also keep her motivated and focus very well. So far there are over 150,000 views on the blog.
Over 10 years ago, Julia spent over 3 months in 2006 to study how to apply teaching job but she never got too far. She remembered that the bible verse teaching about seeds, how to grow the confidence. Seed and soil, Matthew 13 - The Parable of the sower.
Introduction
It is exciting to spend 30 minutes to do some research at the night of Sunday. The topic Julia chose is "Am I a good programmer?". Julia likes to be very competitive hackerrank contest player, good at computer algorithm and data structure. But also Julia likes to be a leader, enjoy the journey by sharing her struggle, learning process of hard topic on algorithm, data structure. How does she advance herself as a software programmer, learning as a system designer, and she also likes to pick up other skills. Like good humour, strong and healthy physical body and strong mental toughness, and good sense of humour, master a sports - tennis.
Julia made a few choices, chose to work on Leetcode algorithms, work on the coding blog, work on code review, Leetcode discussion.
Last weekend Julia spent more than three hours to watch the show on netflix called Quantico, the actress Priyanka has more than 17.9M followers on twitter. Julia likes to spend some time to read how the actress develops skills and build a good connection with peers. The actor Jake wiki page is here.
Coding, learning algorithm, reading and also mocking, Julia starts to get good habit to practice daily. But it is better to take Sunday off . Say no to algorithm and data structure, mocking interviews on Sunday, learn to relax more in the summer. Also Julia has to spend time to work on the sponsor application project.
Julia still calculates how much time she spends on the internet in the week days, she did waste a lot of hours. Instead she should plan better to work on more meaningful activities, like attending Sunday church service, get connected to friends and family, play more sports like tennis single matches, make life more fun and exciting.
Study topic
Over 10 years ago, Julia spent over 3 months in 2006 to study how to apply teaching job but she never got too far. She remembered that the bible verse teaching about seeds, how to grow the confidence. Seed and soil, Matthew 13 - The Parable of the sower.
Julia spent whole month in the city of Canada, so 25% traffic is from Canada. In other words, Julia serves 75% traffic for other people while she enjoys her own blog with 1700 views.
By integrating Leetcode with mocking interview algorithm, Julia also learns to serve other people, help herself as well to learn better on algorithm and data structure. Here is the list of Leetcode algorithms last 3 month Julia worked on. Also 30% of peers were happy to connect Julia on linkedin, total count is 33.
The mocking interview totally changes the view of Linkedin, for a long time, Julia found out that she does not have time to get connected to people face-to-face, work on something together.
Let us look in LinkedIn statistics and figure out something here as well.
Julia spent time on mocking interview last 3 months, 90 mocking takes 90 hours; And Julia worked on related Leetcode algorithms more than 30 hours. She added 33 new Linkedin connections, total 201 views, 15% traffic is related to the new connections. 26 found you via Who Viewed Your Profile, in other words, Julia did some study on linkedIn profiles, 10% traffic is related to the activities. 75% traffic of 150 views are random traffic, Julia could not control and make some influence on it.
Last 3 months Julia did not spend a lot of hours on code review. Here is her profile:
Julia found her most favorite website to study and get great ideas for algorithm, and learn C# programming, for example, C# class SortedSet is good to start. . It is called Leetcode discussion board. Here is Julia's profile on Leetcode discussion.
A few issues needs to be addressed, but Julia will find time to solve them.
Leetcode algorithms
Last 90 days, Julia worked on 52 leetcode algorithms. Here are the list:
52 Leetcode algorithms
8, 10, 18, 23, 33,,37,,39, 44, 45, 47, 48, 54, 55, 57, 69, 72, 76, 78, 79, 114, 121, 122, 123, 128, 140, 151, 153, 189, 212, 220, 239, 295, 300, 416, 459, 480, 516, 551, 572, 575, 582, 591, 605, 606, 609
Saturday, July 8, 2017
Leetcode 151: Reverse word in a string
July 8, 2017
It is very good experience to watch a peer to write a JavaScript, and then Julia took some time to compare her JavaScript knowledge to the peer.
Introduction
It is the learning process to implement the algorithm Leetcode 151 using JavaScript. Plan to do some study and find out some code on Hackerrank or Leetcode discussion implemented in JavaScript.
It is very good experience to watch a peer to write a JavaScript, and then Julia took some time to compare her JavaScript knowledge to the peer.
Algorithm in JavaScript
Will come back to work on the algorithm in JavaScript later.
Previous practice on Leetcode 151 is here.
Plan to read Javascript Array.prototype.reduce 10 - 20 minutes.
John Robert's best advice for young people
July 8, 2017
Plan to watch the video 18 minutes - graduation advice 2017 by John Roberts.
Not afraid to fail. Try again and fail again.
Lonely from time to time, so you do not take friends for granted.
Failure let you know the importance of sportsmanship.
Plan to watch the video 18 minutes - graduation advice 2017 by John Roberts.
Not afraid to fail. Try again and fail again.
Lonely from time to time, so you do not take friends for granted.
Failure let you know the importance of sportsmanship.
Thursday, July 6, 2017
Leetcode 10: Regular Expression Match - dynamic programming
July 6, 2017
Continue to study a DP solution, discussion link is here.
Dynamic programming solution - practice code is here.
Another dynamic programming solution is here. Plan to study the code later.
Study simple test cases and get more ideas how to design dynamic programming solution, code is here.
Dynamic programming is such a difficult solution to go over with. It is a good idea to write the code which can be memorized and also easy to reproduce based on a few of basic rules.
Regular expression matching is a classical algorithm, it is best for the player to train and get some experience how to design a dynamic programming.
We like to talk about base cases, talk about how many options for a*, zero or 1 or more 3 cases. We like to talk about the matrix starting from (0,0) and to (n,m).
----------------------------------------------------------> left
|
|
V top
(left-2, top) (left, top) (left+1, top)
(left, top+1) (left+1,top+1)
Plan to spend 20 minutes to study the following notes in the discussion:
Continue to study a DP solution, discussion link is here.
Dynamic programming solution - practice code is here.
Another dynamic programming solution is here. Plan to study the code later.
Study simple test cases and get more ideas how to design dynamic programming solution, code is here.
Test cases
1 . test case 1:
"aa" matches pattern string "a*". a* counts as multiple a.
2. test case 2:
"a" matches pattern string "a*". a* counts as one a
3. test case 3:
"a" matches pattern string "a*a". a* count as empty
4. test case 4:
"" matches pattern string "a*b*c*". This is the base case. The string is emtpy string.
Dynamic programming is such a difficult solution to go over with. It is a good idea to write the code which can be memorized and also easy to reproduce based on a few of basic rules.
Regular expression matching is a classical algorithm, it is best for the player to train and get some experience how to design a dynamic programming.
We like to talk about base cases, talk about how many options for a*, zero or 1 or more 3 cases. We like to talk about the matrix starting from (0,0) and to (n,m).
----------------------------------------------------------> left
|
|
V top
(left-2, top) (left, top) (left+1, top)
(left, top+1) (left+1,top+1)
Plan to spend 20 minutes to study the following notes in the discussion:
Leetcode 10: Regular Expression Match - One bug a time
July 6, 2016
The regular expression match is the hard algorithm. Julia learns the algorithm more than five time last three months. She learns how to write the code in less than 20 lines of code, but also she learns to write the code with an iterative solution, ends up with more work and time-consuming bugs.
Introduction
Algorithm Code Review
Her practice using C# on May 16 is here. There are a few bugs in her writing.
Here are some highlights of bugs:
1. Line 27 - line 41, counter example, "" and pattern string "a*" or "a*b*". "" matches "a*"
2. Line 77 - 79,
3. Line 84
4. line 90
Here are some highlights of bugs:
1. Line 27 - line 41, counter example, "" and pattern string "a*" or "a*b*". "" matches "a*"
2. Line 77 - 79,
3. Line 84
4. line 90
Wednesday, July 5, 2017
How good are your people skills?
July 5, 2017
It is the first time Julia likes to do some research to help her improve people skills. Julia plans to work on mocking practice every day around 8:00 pm in the summer time, it is challenge for her to meet every day with a peer and fully use 60 minutes to help both parties grow technically.
It is a good idea to do some research about people skills, how to be tactful.
Julia worked the website and she did some multiple choice questions. Here is the link of "How Good Are Your People Skills".
1. Often
2. Often
3. Sometimes
4. Often
5. Sometimes
6. Rarely
7. Rarely
8. Often
9. Sometimes
10. Sometimes
11. Rarely
12. Often
13. Very often
14. Often
15. Sometimes
16. Very often
Here is the article link.
Introduction
It is a good idea to do some research about people skills, how to be tactful.
A 15 minute evaluation
Julia worked the website and she did some multiple choice questions. Here is the link of "How Good Are Your People Skills".
1. Often
2. Often
3. Sometimes
4. Often
5. Sometimes
6. Rarely
7. Rarely
8. Often
9. Sometimes
10. Sometimes
11. Rarely
12. Often
13. Very often
14. Often
15. Sometimes
16. Very often
How to be tactful
Here is the article link.
Tuesday, July 4, 2017
Algorithm to convert integer to a string
July 4, 2017
It is so interesting to review the algorithm Julia wrote in 2014 called to convert integer to a string without using a library function like itoa.
Introduction
Algorithm practice
Two practices are here. First one is to write iterative solution, second one is to write using recursive function.
Implement itoa on geeksforgeeks, the algorithm link is here.
Implement itoa on geeksforgeeks, the algorithm link is here.
Hourrank 22 - Candy Collection
July 4, 2017
It is a great idea to find a hard algorithm to work on. The candy collection is the hard algorithm, which is related to segment tree. The problem statement is here.
Introduction
Algorithm study
Plan to work on the algorithm 30 minutes a time.
Monday, July 3, 2017
Soft Skills The software developer's life manual
July 3, 2017
Plan to read the book called "Soft Skills The software developer's life manual" written by John Z. Sonmez.
It is the first time last seven years Julia starts to meet a peer and learn everything every day over 2 months. People share with her about their choice of choosing a computer science master degree, or Ph.D. program, or app academy program, how important it is to simplify the depth first search algorithm, how to conduct a whiteboard testing, what is the missing base case.
It is a new school for Julia to experience. Because of very high rating Julia has, it is not surprising that Julia meets top talent in the world quickly.
Julia experiences different soft skills through mocking experience. She also likes to read the book on this topic, and also blogs written by the author are much better.
Most favorite one - cooking at home.
5 subtle secrets of effective leaders - link is here.
5 Soft Skills Every Software Developer Should Know - 60 minutes video is here.
Plan to read the book called "Soft Skills The software developer's life manual" written by John Z. Sonmez.
It is the first time last seven years Julia starts to meet a peer and learn everything every day over 2 months. People share with her about their choice of choosing a computer science master degree, or Ph.D. program, or app academy program, how important it is to simplify the depth first search algorithm, how to conduct a whiteboard testing, what is the missing base case.
It is a new school for Julia to experience. Because of very high rating Julia has, it is not surprising that Julia meets top talent in the world quickly.
Julia experiences different soft skills through mocking experience. She also likes to read the book on this topic, and also blogs written by the author are much better.
Most favorite one - cooking at home.
5 subtle secrets of effective leaders - link is here.
5 Soft Skills Every Software Developer Should Know - 60 minutes video is here.
Bucket sort small talk
July 3, 2017
Bucket sort is an algorithm Julia practiced a few time last 12 months. Here is one more practice, two blogs are related to the algorithm, called: Find the smallest integer not in a list.
Minimum Loss practice is here.
Stack overflow link is here.
GeeksForGeeks link is here.
Introduction
Minimum Loss practice is here.
Stack overflow link is here.
GeeksForGeeks link is here.
Algorithm study and practice
Sunday, July 2, 2017
Leetcode 10 - Regular Expression Match II
July 2, 2017
Where is the best place to find better idea for an algorithm? Julia checked the hackerrank leaderboard, but for her practice of Leetcode 10 - Regular Expression Match, she googled using keyword, "Leetcode 10 C# solution", she found one today. Here is the C# solution in the dicussion panel.
Here is the C# solution she need to study today, and the algorithm implemented is better than Julia's one. She likes to study the algorithm.
C# solution using recursive, but no timeout issue. Solution is here.
July 5, 2017
Julia worked as the mocking interviewer 35 minutes on this algorithm, she had some issue to give out clear advise on the iterative solution.
In other words, there are 3 options with string "a" and pattern "a*":
a* counts as empty, why? because it may be "a" and "a*a"
a* counts as single a, so, next will be string "" and pattern ""
a* count as multiple a, so next will be string "" and pattern "a*"
July 6, 2017
Continue to study a DP solution, discussion link is here.
Dynamic programming solution - practice code is here.
Read an Amazon intern story in Chinese - link is here.
Another recursive solution - Julia's most favorite one
C# practice code is here.
Introduction
Where is the best place to find better idea for an algorithm? Julia checked the hackerrank leaderboard, but for her practice of Leetcode 10 - Regular Expression Match, she googled using keyword, "Leetcode 10 C# solution", she found one today. Here is the C# solution in the dicussion panel.
Here is the C# solution she need to study today, and the algorithm implemented is better than Julia's one. She likes to study the algorithm.
Algorithm Study
C# solution using recursive, but no timeout issue. Solution is here.
July 5, 2017
Julia worked as the mocking interviewer 35 minutes on this algorithm, she had some issue to give out clear advise on the iterative solution.
In other words, there are 3 options with string "a" and pattern "a*":
a* counts as empty, why? because it may be "a" and "a*a"
a* counts as single a, so, next will be string "" and pattern ""
a* count as multiple a, so next will be string "" and pattern "a*"
July 6, 2017
Continue to study a DP solution, discussion link is here.
Dynamic programming solution - practice code is here.
Read an Amazon intern story in Chinese - link is here.
Another recursive solution - Julia's most favorite one
C# practice code is here.
Leetcode 10 - Regular Expression Matching
July 2, 2017
It takes a lot of practice to learn one of the hard algorithm on Leetcode. Leetcode 10 regular expression matching's problem statement is here.
Julia practiced the algorithm more than five times in last three months, she wrote more than two times in her practice as an interviewee, and then she mocked interview more than three people to work on the algorithm.
One of best codes is here written in Ruby, Julia met a very experienced programmer and then learned a few things. The code is here. Julia will write it using C#, and then try to run against Leetcode 10 online judge and see how many things are missing.
July 2, 2017 2:48 pm
Julia spent 40 minutes to work on C#, and the code is working except timeout issue. C# code is here.
3:02 pm, Julia added memo as a Dictionary<string, bool>, to simplify the problem, assuming that " " is not used in regular expression matching, the code passes all test cases.
C# code is here.
Julia could not figure out the solution by herself, so she googled and then came cross this solution through Leetcode discussion. C# code is here. Leetcode discuss link is here. She wrote a blog about the solution, link is here.
July 6, 2017
One more recursive solution without using memo is here.
July 2, 2017 2:48 pm
Julia spent 40 minutes to work on C#, and the code is working except timeout issue. C# code is here.
July 6, 2017
To solve timeout issue, it is to early return the recursive tree, do not go over every node of tree.
Here is the C# code.
It is a brutal truth, Julia is not ready to be a professional interviewer or expert on algorithm. She could not spot the timeout bug in the code. She took more than 4 days and then figure out the bug. Right side is the C# code written in July 2 with a timeout bug, left side is the bug-free code.
The return statement with the format of "return A || B" will not run B if A is true. In other words, "return A || B" is not the same as
bool result = A;
result |= B;
The above solution to separate in two statements will cause timeout, since every branch of recursive tree will be executed. It is a fatal bug.
Inspired by the short and clean code, Julia continued to make the C# code short and clean. C# code is here.
One more step to simplify the code, code is here.
It is so exciting to learn a hard algorithm through so many practice and code review. Julia worked with over 5 peers to solve the algorithm, she also wrote more than 5 times. Through the journal of the practice, she is able to track her progress and learn to solve the problem.
It is so much fun once the timeout bug is found through online judge on July 2. Julia kept reading more solutions until she found out the real issue - subtle bug in the writing.
Introduction
Algorithm Practice
One of best codes is here written in Ruby, Julia met a very experienced programmer and then learned a few things. The code is here. Julia will write it using C#, and then try to run against Leetcode 10 online judge and see how many things are missing.
July 2, 2017 2:48 pm
Julia spent 40 minutes to work on C#, and the code is working except timeout issue. C# code is here.
Memoization Solution
One of the solutions is to use memoization to solve the problem.
C# code is here.
No Memo Solution
Julia could not figure out the solution by herself, so she googled and then came cross this solution through Leetcode discussion. C# code is here. Leetcode discuss link is here. She wrote a blog about the solution, link is here.
July 6, 2017
One more recursive solution without using memo is here.
Problem solving
Julia spent 40 minutes to work on C#, and the code is working except timeout issue. C# code is here.
July 6, 2017
To solve timeout issue, it is to early return the recursive tree, do not go over every node of tree.
Here is the C# code.
It is a brutal truth, Julia is not ready to be a professional interviewer or expert on algorithm. She could not spot the timeout bug in the code. She took more than 4 days and then figure out the bug. Right side is the C# code written in July 2 with a timeout bug, left side is the bug-free code.
The return statement with the format of "return A || B" will not run B if A is true. In other words, "return A || B" is not the same as
bool result = A;
result |= B;
The above solution to separate in two statements will cause timeout, since every branch of recursive tree will be executed. It is a fatal bug.
Inspired by the short and clean code, Julia continued to make the C# code short and clean. C# code is here.
One more step to simplify the code, code is here.
Summary
It is so exciting to learn a hard algorithm through so many practice and code review. Julia worked with over 5 peers to solve the algorithm, she also wrote more than 5 times. Through the journal of the practice, she is able to track her progress and learn to solve the problem.
It is so much fun once the timeout bug is found through online judge on July 2. Julia kept reading more solutions until she found out the real issue - subtle bug in the writing.
Super Mancunian - HourRank 22
July 2, 2017
It is a minimum spanning tree algorithm. But there is additional work to remove max cost edge in the tree. Julia started to work on the algorithm last 30 minutes, she spent 10 minutes to go over the problem statement and then figured out the whole requirement. She only had 20 minutes, she fumbled, and she looked at the leaderboard, checked players from Google's performance, she likes to write a simple code to score partial points to make her a medal player.
Too short time, it just reminds her that she needs to work on and review what she works on. She just needs to look into past work and then find a solution to score the points.
An algorithm makes her Sunday morning so challenging.
Introduction
Too short time, it just reminds her that she needs to work on and review what she works on. She just needs to look into past work and then find a solution to score the points.
An algorithm makes her Sunday morning so challenging.
Algorithm
Previous practice on Kruskal's algorithm is here. Julia spent wrong on the name, she spelled Krusal. In order to pay respect the scientist, Julia decided to review his wiki page and get more detail on his work.
Read wiki page as well. Plan to spend one hour to read this Sunday morning.
Read wiki page as well. Plan to spend one hour to read this Sunday morning.
Saturday, July 1, 2017
Snack down finals 2017
July 1, 2017
It is so happy to read a blog from the very competitive algorithm player and problem setter.
A blog about algorithms, contest and maths - Aleigorithms.
The problems are here.
It is so happy to read a blog from the very competitive algorithm player and problem setter.
A blog about algorithms, contest and maths - Aleigorithms.
The problems are here.
Three things to learn Canada day
July 1, 2017
It is Canada day. Julia likes to celebrate the day as a Canadian citizen. She also likes to do some work for immigration application. Julia likes to work hard and plan to provide high quality work for the application.
It is so good to come cross the immigration law and learn how to apply to myself, commonly referred "lonely Canadian". Julia has a sister who has strong legal knowledge and she likes to question anything, so she read a lot and then she gave Julia an advice to look into immigration law. So after the conversation, Julia looked into the Canada immigration law, in less than 30 minutes, she found the law of sponsorship to apply herself. Sometimes it does not matter how strong you have the ability to do research, it is how you treat other people's opinion, how open you are to connect to people, be friends with people, fair to listen to people's opinion.
Learning a law is easy and apply the law takes courage and hard work.
Here is the video related to "Family Class: Sponsoring Overage Siblings".
Free webinar: Family Sponsorship for Canada - 19 minutes video link is here.
Follow up
Dec. 22, 2019
I walked in an office in crystal mall, the officer works on application for admission to universities, I asked her a few questions. And she also told me that even parents cannot sponsor their adult children if the child is over 22 years old. My nephew turned 25 years old this year.
I explained to her that lonely Canadian program, and how I applied for my nephew. The whole process took me a few years, starting from 2016, and he landed in May 2019.
Introduction
It is Canada day. Julia likes to celebrate the day as a Canadian citizen. She also likes to do some work for immigration application. Julia likes to work hard and plan to provide high quality work for the application.
Study and work
Julia likes to do some research to help herself to get more educated on the application. She starts to find some videos on youtube.com.
July 3, 2017 5:55 pm
It is a long weekend. Julia did some study on her sponsor application. She spent a lot of hours to study youtube video about other people's sharing, and also she started to think about how to hold high standard for her own work. Professional consultant asks $3,000 Canadian dollars, after over 10 hours work and study this weekend, Julia found out the joy to go back to work on the case after a six-month -break, a return application just allowed her to see that her work based on 1,00 hours study could not compare to the professional consultant work. But Julia is a learner, she likes to get back and relax, try again, fail again, fail better.
As a software programmer, Julia could not take a whole weekend break only for immigration application, she still chose to work on algorithm mocking interview and practice for a few hours. But she learns to be gentle to herself, one mocking interview only. It took 100 minutes.
Bible teaching is here, Julia likes to share the bible verse to encourage herself to be a hard worker.
Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty.
Follow up
It is a long weekend. Julia did some study on her sponsor application. She spent a lot of hours to study youtube video about other people's sharing, and also she started to think about how to hold high standard for her own work. Professional consultant asks $3,000 Canadian dollars, after over 10 hours work and study this weekend, Julia found out the joy to go back to work on the case after a six-month -break, a return application just allowed her to see that her work based on 1,00 hours study could not compare to the professional consultant work. But Julia is a learner, she likes to get back and relax, try again, fail again, fail better.
As a software programmer, Julia could not take a whole weekend break only for immigration application, she still chose to work on algorithm mocking interview and practice for a few hours. But she learns to be gentle to herself, one mocking interview only. It took 100 minutes.
Bible teaching is here, Julia likes to share the bible verse to encourage herself to be a hard worker.
Proverbs 21:5 The plans of the diligent lead to profit as surely as haste leads to poverty.
July 8, 2017 10:55 am
Immigration ranking: Lonely Canadian
It is so good to come cross the immigration law and learn how to apply to myself, commonly referred "lonely Canadian". Julia has a sister who has strong legal knowledge and she likes to question anything, so she read a lot and then she gave Julia an advice to look into immigration law. So after the conversation, Julia looked into the Canada immigration law, in less than 30 minutes, she found the law of sponsorship to apply herself. Sometimes it does not matter how strong you have the ability to do research, it is how you treat other people's opinion, how open you are to connect to people, be friends with people, fair to listen to people's opinion.
Learning a law is easy and apply the law takes courage and hard work.
Here is the video related to "Family Class: Sponsoring Overage Siblings".
Free webinar: Family Sponsorship for Canada - 19 minutes video link is here.
Follow up
Dec. 22, 2019
I walked in an office in crystal mall, the officer works on application for admission to universities, I asked her a few questions. And she also told me that even parents cannot sponsor their adult children if the child is over 22 years old. My nephew turned 25 years old this year.
I explained to her that lonely Canadian program, and how I applied for my nephew. The whole process took me a few years, starting from 2016, and he landed in May 2019.
Friday, June 30, 2017
Effective C# 50 Specific Ways to Improve Your C#
June 30, 2017
Plan to read a book:
Effective C# 50 Specific Ways to Improve Your C#
Plan to read a book:
Effective C# 50 Specific Ways to Improve Your C#
Leetcode 76: Minimum Window Substring
June 30, 2017
Leetcode 76 minimum windows substring is such a popular algorithm, Julia was asked to work on the algorithm in mocking experience, the peer likes Julia to work on the string algorithm, and the peer gave the advice that Julia's solution will have time out issue.
Mocking 8:00 pm - 8:30 pm
Here is the C# practice in mocking experience, the code has timeout issue. Time complexity should be cut down.
Here is the C# practice to pass online judge of Leetcode 76.
Read one of discussions - link is here.
Need to write a short and better solution.
The current window is
Julia is very good at writing the code, she just need a good idea to work on.
C# code is rewritten, link is here.
What can I say after I debug the code using a test case? This code is hard to understand, one dictionary serves multiple purposes. It reminds me the algebra.
For example, "xxyz", search string is "xyz".
We can keep the search string in the dictionary<char, int>
dict['x'] = 1,
dict['y'] = 1,
dict['z'] = 1
Now, we like to use those values to track how many in the sliding window. If the sliding window is "xx", then dict['x'] = -1. If the value is 0, then the number of char is exactly what need. -1 means that there is extra one.
We also keep count of how many chars we need in search string. First visit of x in sliding window "xx" we increment count variable once, but second one we do not do that. In other words, there is only one 'x' in search string. From any iteration, it is easy to tell if the sliding window contains the search string by comparing count variable with the length of search string.
Queue is not necessary, just track the left position of sliding window. One advantage to use queue is to filter out characters not in the search string.
Move Queue from the code, and come back to work on the algorithm later.
Most important is to check time complexity of this idea, it is better than O(s.Length * t.Length), actually it is O(s.Length).
Introduction
Algorithm study
Here is the C# practice in mocking experience, the code has timeout issue. Time complexity should be cut down.
Here is the C# practice to pass online judge of Leetcode 76.
Leetcode Discussion
Read one of discussions - link is here.
Need to write a short and better solution.
The current window is
s[i:j] and the result window is s[I:J]. In need[c] I store how many times I need character c (can be negative) and missing tells how many characters are still missing. In the loop, first add the new character to the window. Then, if nothing is missing, remove as much as possible from the window start and then update the result.Julia is very good at writing the code, she just need a good idea to work on.
C# code is rewritten, link is here.
What can I say after I debug the code using a test case? This code is hard to understand, one dictionary serves multiple purposes. It reminds me the algebra.
For example, "xxyz", search string is "xyz".
We can keep the search string in the dictionary<char, int>
dict['x'] = 1,
dict['y'] = 1,
dict['z'] = 1
Now, we like to use those values to track how many in the sliding window. If the sliding window is "xx", then dict['x'] = -1. If the value is 0, then the number of char is exactly what need. -1 means that there is extra one.
We also keep count of how many chars we need in search string. First visit of x in sliding window "xx" we increment count variable once, but second one we do not do that. In other words, there is only one 'x' in search string. From any iteration, it is easy to tell if the sliding window contains the search string by comparing count variable with the length of search string.
Queue is not necessary, just track the left position of sliding window. One advantage to use queue is to filter out characters not in the search string.
Move Queue from the code, and come back to work on the algorithm later.
Most important is to check time complexity of this idea, it is better than O(s.Length * t.Length), actually it is O(s.Length).
C# SortedSet talk
June 30, 2017
It is a great idea to learn C# programming language using Leetcode. Julia searches Google using keyword "C# SortedSet Leetcode", and then she finds the following algorithms to work on:
Leetcode 23 Merge K Sorted Lists
Leetcode 57 Insert Intervals
Leetcode 128 Longest Consecutive Sequence
Leetcode 220 Remove Duplicate III
Leetcode 239 Sliding Window Maximum
Leetcode 295 Median of Streams
It takes a few hours to study those algorithm written using C# SortedSet.
It is a great idea to learn C# programming language using Leetcode. Julia searches Google using keyword "C# SortedSet Leetcode", and then she finds the following algorithms to work on:
Leetcode 23 Merge K Sorted Lists
Leetcode 57 Insert Intervals
Leetcode 128 Longest Consecutive Sequence
Leetcode 220 Remove Duplicate III
Leetcode 239 Sliding Window Maximum
Leetcode 295 Median of Streams
It takes a few hours to study those algorithm written using C# SortedSet.
Leetcode 295: Median of Stream
June 30, 2017
Work on the C# code using SortedSet. Here is C# practice.
Review book: Effective C# 50 Specific Ways to Improve your C#, Item 31: Implement ordering relations with ICompare<T> and IComparer<T>
Work on the C# code using SortedSet. Here is C# practice.
Review book: Effective C# 50 Specific Ways to Improve your C#, Item 31: Implement ordering relations with ICompare<T> and IComparer<T>
Leetcode 23: Merge K Sorted Lists
June 30, 2017
Julia tried to learn more about C# SortedSet, so she googled "C# SortedSet Leetcode" first, and worked on a few algorithms implemented using SortedSet.
C# practice is here.
Julia tried to learn more about C# SortedSet, so she googled "C# SortedSet Leetcode" first, and worked on a few algorithms implemented using SortedSet.
C# practice is here.
Leetcode 239: Sliding Window Maximum
June 30, 2017
Julia is learning C# SortedSet, so she chose the algorithm to practice SortedSet. C# practice is here.
Julia is learning C# SortedSet, so she chose the algorithm to practice SortedSet. C# practice is here.
Leetcode 57: Insert intervals
June 30, 2017
Julia likes to learn to use C# SortedSet, and then the algorithm can be implemented using the class. C# code is here.
Julia likes to learn to use C# SortedSet, and then the algorithm can be implemented using the class. C# code is here.
Leetcode 128: Longest Consecutive Sequence
June 30, 2017
It is a great idea to learn C# SortedSet by looking up Leetcode algorithms, search Google using keyword: "C# SortedSet Leetcode". Here is the C# practice code.
It is a great idea to learn C# SortedSet by looking up Leetcode algorithms, search Google using keyword: "C# SortedSet Leetcode". Here is the C# practice code.
Wednesday, June 28, 2017
Common mistakes talk
June 28, 2017
It is a good idea to celebrate 80 times mocking experience with a coding blog. What is the good topic? Julia learned a lot, and she likes to write common mistakes in the mocking experience.
Julia did some research on the topic "Do mocking make difference?". Julia likes to set a new goal for her practice, improve her communication.
One interesting topic Julia likes to bring up is 3000 algorithm practice, Julia likes to build up skills by playing hackerrank contest, Leetcode practice and mocking experience. And also Julia learns to journal her emotions through the practice in order to build mental toughness.
Julia started to cut short those long hours for Hackerrank contest, she likes to write a few blogs when she prepares to solve a medium or expert level algorithm, she also likes to read some good lecture notes and do some research on the topic, certainly Julia learns to succeed on week code of 33 and enjoyed her first gold medal.
Here are 10 more mistakes Julia learns from her last 80 mocking experience:
1. One of the peers asked very politely in the first minute, how does the mocking work? Are you a professional? Question is how to show up very professionally? Age difference?
2. Prepare peer's algorithm very well as an interviewer. For example, quickly look up Google and get an API stackoverflow link for the peer.
3. Miss base cases in the algorithm analysis
4. Do not talk and explain the base case in DFS design in the first place. Need to learn more about DFS algorithm design, know different kinds of solutions, and then communicate efficiently.
5. Easy to get stuck or be distracted from the algorithm.
6. Fail to come out dynamic solution or recurrence formula quickly. Julia did notice the issue in her first round.
7. Some of peers expect the code ready to run with test cases and you should show the correct result.
Work hard until you can write the algorithm and make sure that the algorithm can run. Practice more.
The third time Julia wrote the same algorithm and then she was asked to run the code, she had a few bugs to fix.
8. Do not write code until you have fully figured out the algorithm. Explain the algorithm and share your thinking process. Julia had the mistake in one of her first 20 mocking practice.
9. Learn whiteboard testing. But test the code very hard. Do not fake it. Julia still found bugs by running the code using sample test case, after whiteboard testing. Do not fake the testing, work hard.
10. Prepare to extend the algorithm if the peer finish only first 10 minutes, try to extend the algorithm until the peer fails. Know how to measure the depth of the knowledge. Julia figured out after practicing more than 80 mocking practices.
11. Miss the optimal solution for an algorithm after more than 3 times practices. Julia knew the issue after 90 mocking practice.
12. There are always something new coming out in each mocking experience. Julia noticed that after she started third round.
Introduction
It is a good idea to celebrate 80 times mocking experience with a coding blog. What is the good topic? Julia learned a lot, and she likes to write common mistakes in the mocking experience.
Julia did some research on the topic "Do mocking make difference?". Julia likes to set a new goal for her practice, improve her communication.
One interesting topic Julia likes to bring up is 3000 algorithm practice, Julia likes to build up skills by playing hackerrank contest, Leetcode practice and mocking experience. And also Julia learns to journal her emotions through the practice in order to build mental toughness.
Julia started to cut short those long hours for Hackerrank contest, she likes to write a few blogs when she prepares to solve a medium or expert level algorithm, she also likes to read some good lecture notes and do some research on the topic, certainly Julia learns to succeed on week code of 33 and enjoyed her first gold medal.
Common mistakes
Julia was complained once that she made the mocking experience like an exam, it should be a conversation. And another time Julia was told that if she was given a hint, she should take it, do not be a hacker. Julia learns to respect the peer and follow the direction right away. So she was surprised that today mocking experience, she tried to give same advice, but the peer did not take it.
Here are 10 more mistakes Julia learns from her last 80 mocking experience:
1. One of the peers asked very politely in the first minute, how does the mocking work? Are you a professional? Question is how to show up very professionally? Age difference?
2. Prepare peer's algorithm very well as an interviewer. For example, quickly look up Google and get an API stackoverflow link for the peer.
3. Miss base cases in the algorithm analysis
4. Do not talk and explain the base case in DFS design in the first place. Need to learn more about DFS algorithm design, know different kinds of solutions, and then communicate efficiently.
5. Easy to get stuck or be distracted from the algorithm.
6. Fail to come out dynamic solution or recurrence formula quickly. Julia did notice the issue in her first round.
7. Some of peers expect the code ready to run with test cases and you should show the correct result.
Work hard until you can write the algorithm and make sure that the algorithm can run. Practice more.
The third time Julia wrote the same algorithm and then she was asked to run the code, she had a few bugs to fix.
8. Do not write code until you have fully figured out the algorithm. Explain the algorithm and share your thinking process. Julia had the mistake in one of her first 20 mocking practice.
9. Learn whiteboard testing. But test the code very hard. Do not fake it. Julia still found bugs by running the code using sample test case, after whiteboard testing. Do not fake the testing, work hard.
10. Prepare to extend the algorithm if the peer finish only first 10 minutes, try to extend the algorithm until the peer fails. Know how to measure the depth of the knowledge. Julia figured out after practicing more than 80 mocking practices.
11. Miss the optimal solution for an algorithm after more than 3 times practices. Julia knew the issue after 90 mocking practice.
12. There are always something new coming out in each mocking experience. Julia noticed that after she started third round.
Related work from Hackerrank contest
Julia likes to play tennis sports and play hackerrank contests. Both needs hard work.
Julia played over hundreds of hours tennis sports, hundreds of double and single matches, experienced the muscle pain and all kinds of issues, she also experienced a lot of joy through the hard work. She learns to control the ball and placement so well over thousands of strokes, she gains the new sports skills.
Related to tennis sports, from June 2016 to June 2017, Julia built up similar experience through Hackerrank contests, she journal every practice, wrote down her emotion, time to play, short term and long term goal, she started to collect 7 bronze medal, 2 silver medals, one gold medal last 12 months. Exactly after 12 month, she got her first gold medal, top 4% in ranking of over 11,000 players. She adapted her skills on tennis sports to competitive programming field.
Julia played over hundreds of hours tennis sports, hundreds of double and single matches, experienced the muscle pain and all kinds of issues, she also experienced a lot of joy through the hard work. She learns to control the ball and placement so well over thousands of strokes, she gains the new sports skills.
Related to tennis sports, from June 2016 to June 2017, Julia built up similar experience through Hackerrank contests, she journal every practice, wrote down her emotion, time to play, short term and long term goal, she started to collect 7 bronze medal, 2 silver medals, one gold medal last 12 months. Exactly after 12 month, she got her first gold medal, top 4% in ranking of over 11,000 players. She adapted her skills on tennis sports to competitive programming field.
Julia plays so many contests, there is always next one. No time to get frustrated long because she has to play next one and stay at the moment. It is hard to deal with frustration and expectation, but Julia learns to take care of herself with a lot of sports competition matches, just remind her that hard work beats the talent. Wishful thinking wastes time, but choose to sports therapy, learn from tennis professional players to work on basics.
Learn to count algorithms
It is not easy to stay humble for computer science Ph.D.
students. Julia worked on the computer science Ph.D. study from 2001 to 2010,
she never learned to count how many algorithms she works on. There is no
target, no goal setting on algorithm practice, and there is no result.
How does Julia happen to make changes after her full time
work last 7 years? Julia learned the tough lesson when she developed the sales
analysis report. She was challenged again and again about the number she
provided, she did not handle the pressure very well the first few years. From 2010 to 2015, Julia does not count how many algorithms she works on.
Starting from 2015, she put months hard work together to rewrite C# code with the new design, she likes to integrate with Microsoft Excel easily so she can continuously build some analysis.
Starting from 2015, she put months hard work together to rewrite C# code with the new design, she likes to integrate with Microsoft Excel easily so she can continuously build some analysis.
One day she sets a goal, she likes to be able to verify the final number in less than five minutes; she added the drill-down functionality in her
report, she can quickly export large data sets and use Microsoft Excel to do
further analysis to find root cause if need.
Be a top player in algorithm and data structure contest on
hackerrank, Julia also sets up a goal.
Her goal is to complete 3000 algorithm practice, enjoy the journey; she works on leetcode, meanwhile playing hackerrank contest; when she plays hackerrank contest, she uses Leetcode algorithms to help her to be a better player. She only completes over 100 algorithm related to Leetcode algorithm. Her gists shows 851 gists on June 29, 2017.
Her goal is to complete 3000 algorithm practice, enjoy the journey; she works on leetcode, meanwhile playing hackerrank contest; when she plays hackerrank contest, she uses Leetcode algorithms to help her to be a better player. She only completes over 100 algorithm related to Leetcode algorithm. Her gists shows 851 gists on June 29, 2017.
— Tennis Coaching™️ (@tennisdothow) September 22, 2016
C# Minimum Heap implementation
June 28, 2017
There is a PriorityQueue class in Java for minimum heap, but in csharp programming language, there is no class. Julia has to figure out how to write one by herself.
Search the blog using minimum heap implementation, the link is here.
8:00 pm - 8:30 pm C# practice is here.
Julia met a peer who is a computer science Ph.D., and she was asked to simulate the minimum heap using Array, Array.Sort. Julia followed the hint and she did write one. It works and the solution is correct. But she likes to make her simulation better. There is only 30 minutes in mocking experience, Julia could not write a real minimum heap so she chose to use an array and then sort it using O(nlogn) algorithm.
She needs to look into C# books and figure out how to do it better in short future.
One of ideas is to use C# SortedSet class. Review previous practice on Leetcode 295: Median of stream.
Introduction
Search the blog using minimum heap implementation, the link is here.
Algorithm study
Julia met a peer who is a computer science Ph.D., and she was asked to simulate the minimum heap using Array, Array.Sort. Julia followed the hint and she did write one. It works and the solution is correct. But she likes to make her simulation better. There is only 30 minutes in mocking experience, Julia could not write a real minimum heap so she chose to use an array and then sort it using O(nlogn) algorithm.
She needs to look into C# books and figure out how to do it better in short future.
One of ideas is to use C# SortedSet class. Review previous practice on Leetcode 295: Median of stream.
Book reading: Essential C# 4.0
June 28, 2017
It is the seventh year Julia works on C# programming on the current job in the city of Vancouver. Last 2 years Julia tried so hard to reinvent herself, she chose to work on Leetcode, coding blog, and focus on the basics.
Julia knows that it is so enjoyable to read a C# book in her spare time, she did today using 20 minutes, on the topic called "16 Building Custom Collections".
Actionable Item
Next book to read:
Effective C# 50 Specific Ways to Improve Your C#
Second Edition Scott Meyers
Book review is here.
Introduction
Julia knows that it is so enjoyable to read a C# book in her spare time, she did today using 20 minutes, on the topic called "16 Building Custom Collections".
Book reading plan
Actionable Item
Next book to read:
Effective C# 50 Specific Ways to Improve Your C#
Second Edition Scott Meyers
Book review is here.
Subscribe to:
Posts (Atom)







