Construct Binary Search Tree from Pre Order Traversal

It is Thanksgiving Week 2020 and we do not have a winner in the 2020 Presidential Elections yet. The amount of fraud in this year’s elections has been unprecedented. My comment has nothing to do with politics. It is just based on common sense for individuals 12 years of age and older. I have friends and relatives living in different parts of the world. Their confidence and respect in the USA is almost (never generalize) gone.

On multiple occasions and referring to different topics, I have mentioned in this blog a technique used when people want to understand the positions of each other. First both argue on behalf of their own positions. Then, and this is the key of the technique, they switch positions and argue in favor of the opposite position. It is amazing what you can learn about different ideas when you use this technique. The reason for this tends to be based on facts and logic. Continue reading “Construct Binary Search Tree from Pre Order Traversal”

Print Immutable Linked List in Reverse

Hi gals and guys. Hope you are doing well during the COVID-19 pandemic. It seems that most of us are somewhat tired following the basic rules that reduce the spread of the coronavirus. By relaxing the rules in the past few months, the numbers of COVID-19 infections, in most cities worldwide, are going up. Note that the issue is the number of infections, not the number of deaths. Infected people may need hospital services. If the number of patients is larger than the capacity like it was when this thing started, then we have a problem. At this point in time, people with most infections per 1,000, is people in college age. Please follow the rules! We all benefit from it. Continue reading “Print Immutable Linked List in Reverse”

Dates in Java

Today I woke up around 05:00 AM. Later this morning my wife has a lab appointment at 08:15 AM. I decided to get up, cancel my 06:00 AM alarm, and set a new alarm for 07:15 AM. That should give us ample time to get ready and drive to the appointment. Will have breakfast when we get back because she needs to fast for the blood test.

Not sure what is going on with the Presidential Election 2020 results. As I have mentioned in a previous post, the entire process is open to fraud. Do not understand how in the USA we do not use a voter ID card. In addition we should have a secure system in which voters go to their designated polling sites and vote electronically. A paper receipt can be used by voters to make sure the ballot is counted and has not been tampered with. Election Day should be the only day one can vote. If you miss it because it is not important to you, so you can wait four years and plan accordingly. Continue reading “Dates in Java”

Angle Between Hands of a Clock – Java

It is Tuesday November 03, 2020 and it is Election Day. As it is customary my wife and I got up at 06:00 AM. I prepared our usual breakfast (yogurt, mixed fruits, homemade granola and bananas). We have been preparing the same breakfast for a decade or so.

After breakfast, we both got ready and headed to our designated polling location. There were two lines. Both were moving at a reasonable rate. Once we got our ballots we filled them and inserted in the counting machine. We were at the site for about 15 minutes. All went as expected. Continue reading “Angle Between Hands of a Clock – Java”

Coin Change

Hope you are doing well and keeping safe! Last evening my wife and I, after stopping a movie we were watching on Netflix, went to bed. It was still snowing on and off. We were both very tired. Today when we were having breakfast, we noticed that the driveway and path to our door had been cleared of snow. We did not hear a thing. That confirms we were really tired last evening.

One of my best friends (have two sent me the link to the article “Top Universities Took Billions in Unreported Foreign Funds, U.S. Finds”, by the Wall Street Journal. The article is quite interesting. It shows how China is gifting money (there are no free lunches) to top USA learning institutions (mostly Ivy League universities) in order to take / steal intellectual property, allowing China to avoid developing technologies at much higher costs. This was discovered due to the fact that those same institutions have been forgetting to pay the associated gift / donation taxes. Shame on you Cornell University! Continue reading “Coin Change”

Reverse Only Letters

Definitely the weather is changing in the Twin Cities of Minneapolis and St. Paul. Last night my wife and I slept with a windows in the kitchen opened just a crack. This morning the upstairs temperature was at 69F. During winter we keep the upstairs at 68F. Chances are that this evening will sleep with the windows closed and the heater on.

I need to update my post previous post Count Negative Numbers in a Sorted Matrix. I made an incorrect statement and would like to generate an update. If you are curios, I left the body of the post as it was. I generated an opening note. Continue reading “Reverse Only Letters”

Rotate String

It is Saturday morning in the Twin Cities of Minneapolis and St. Paul. It looks like we will have a cloudy day about 10F colder than yesterday. Sooner or later winter will arrive.

Yesterday afternoon I took out a pork butt from the garage freezer and placed it in the kitchen for it to defrost. This morning after breakfast, my wife and I cut the pork into pieces and placed it into two tin foils. My wife added two different mixes of herbs and spices, some liquids and both tins went into the oven. I set the temperature to 325F. We expect to have lunch around 02:00 PM. We are debating if we will have the pork with some rice or potatoes. For simplicity we are leaning towards brown rice. Continue reading “Rotate String”

Maximum Depth of a Binary Tree

Good morning. Hope your day has started on the right note. A couple weeks ago, the extended weather forecast for the Twin Cities of Minneapolis and St. Paul had the high temperatures in the low 60’s and 70’s. This week we have experienced high temperatures in the mid 80’s. It seems that with the power of the cloud, large models that make use of AI, and tons of data, accuracy predicting the weather is still out of our reach.

I have a lifetime friend. Our friendship started in elementary school. Now with the COVID-19 (or Chinese flu) pandemic we connect using Skype on Friday at 07:00 AM. By 08:00 AM we both start or work day. Continue reading “Maximum Depth of a Binary Tree”

Divide Two Integers

Yesterday I read a very interesting article “China is escalating its punishment diplomacy” by Jamil Anderlini in the Financial Times. If you did not get a chance to read it, please do so. You will be surprised how open China is manipulating politicians all over the world.

Another article of interest might be “China sharply expands mass labor program in Tibet” by Cate Cadell in Reuters. The Chinese communist government is picking up people in Tibet, teaching and deploying them to work in groups all over China. The article seems to validate the idea that the cost of manufacturing in China is going up and in order to continue to attract companies to manufacture in China, they need cheap labor. China uses a 72-hour work week which is getting expensive, and in order to continue to be the single provider of globalization, they need to get cheap labor. Continue reading “Divide Two Integers”

Reverse Words in a String

I am a morning person and I do not seem to need eight hours of sleep a day. Earlier this morning (around 01:00 AM) I woke up and browsed the news on my phone. Most (never generalize) were not worth reading. They seem to have a catchy title, but after a few sentences a political message that had nothing to do with the main topic would come up. To top it off you have to reference the information from different sources due to the amount of fake news circulating in most (never say all) platforms.

My wife and I left a window in the kitchen open overnight. We both tend to sleep better with fresh air. Given that we live in the Twin Cities of Minneapolis and St. Paul, sooner rather than later we will have to keep the windows closed and the furnace on.

I just picked a random problem from LeetCode. Problem 151 Reverse Words in a String calls for reversing the order of words in a string. If interested please take a look at the description and spend a few minutes figuring out how to tackle the problem… Continue reading “Reverse Words in a String”