Number of Visible Nodes

Good day! Hope you are doing well. Apparently the number of COVID-19 cases in the Twin Cities of Minneapolis and St. Paul has risen. In addition it seems that the number of free ICU beds had dropped closely to 0. This implies that a person who falls sick and needs intensive care might have a tough time finding an available bed. For our own sake, please follow distancing rules and keep safe. We all will benefit from such behavior.

I have been looking at some problems in a Facebook portal. They are intended as exercises for technical interviews. Continue reading “Number of Visible Nodes”

Validate Binary Search Tree – Revisited

Hope you enjoyed Thanksgiving Day 2020. My wife and I did even though it was just the two of use for late lunch. We prepared our usual menu with some minor twists. The menu was a young turkey (we usually cook a 20+ lbs bird) which came in at around 11 lbs. with potatoes casserole and meat stuffing (we not prepare the popular / traditional bread based kind). For desert we had monkey bread which we got from one of our neighbors. We had a little more than we should, so we decided to skip our after lunch espresso.

For the turkey, we added some spices, a little garlic clove, some butter and apple vinegar. We inserted a thermometer and cook it to 175F. We then took it out of the oven and let it rest. Typically the temperature rises north of 180F. Since the turkey weighted 11 lbs., the temperature only went up to 178F. Continue reading “Validate Binary Search Tree – Revisited”

Continuous Subarray Sum

Tomorrow is Thanksgiving Day 2020. My wife finished preparing three containers with cheesy potatoes casserole. She has been making this dish as far as I can remember. Due to the ingredients we tend to have it once or twice a day. I will provide the recipe and some pictures on tomorrows post. If I am not able to solve a problem and generate a post, will generate a post as soon as possible.

We are still in the midst of the COVID-19 pandemic. About two million people around the world have die of complications related to the novel coronavirus. My wife and I have some friends’ originally from Vietnam. We learned today that one of them is in the hospital and the other barely making it at home. One of my wife’s brothers has been diagnosed with COVID-19. He, his wife and two kids are in quarantine at home. Our best wishes and our thoughts go out to them for a quick and safe recovery. Continue reading “Continuous Subarray Sum”

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”

Maximum Length of a Concatenated String with Unique Characters

Hello and hope you are doing well. Today the temperature went up to 51F in the Twin Cities of Minneapolis and St. Paul. I did not get a chance to go out. Hopefully we will experience a mild winter this year.

Sorry but it is the middle of the week (hump day) and I do not have much to tell you. Time appears to be passing quite fast. Many cities in the country are upping COVID-19 restrictions. It is going to be an interesting Thanksgiving Day coming up in about a week. My wife and I will be preparing a meal. Will take some to our family and on our way back will get on-line (Jitsi or Skype) and will enjoy the meal. Continue reading “Maximum Length of a Concatenated String with Unique Characters”

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”

Backspace String Compare

It is a Saturday morning in the Twin Cities of Minneapolis and St. Paul. As we have been doing for a few months, my wife and I drove to the Costco store in Minneapolis, met with our son and went grocery shopping. Today we were not able to find Three Berry Blend bags. We got separate bags of strawberries and blueberries. Our son will stop later today at the Costco in Eagan. MN and will see if he is able to find a couple bags of mixed berries and a box of pens that we forgot while in Minneapolis.

This week I watched the Association for Computing Machinery (ACM) webinar “Lessons from COVID-19: Efficiency vs. Resilience” by Moshe Y. Vardi. It seems that the webinar is only accessible if you are an ACM member, which I am. I enjoyed the point he made of efficiency versus resilience not only at the software but also at the political level. At no point he mentioned politicians or political parties. In my opinion, it is a very good one-hour webinar worth your time. Continue reading “Backspace String Compare”

First Unique Character in a String

It seems that time is passing faster and faster. The reason seems to be the lack of variety in our lives. The COVID-19 pandemic for most has imposed limiting factors for social activities. I do not mind getting on-line with coworkers, friends and family, but nothing beats in-person interactions. Hopefully things will get better in the next few months. It seems that several pharmaceutical companies are moving along with their tests for their vaccines.

I selected LeetCode problem 387 First Unique Character in a String. It is catalogued as an Easy problem. That said, like most things in life, there are different ways to skin a cat, but one is best given your specific circumstances. I get a kick when I read about competitive programming. I have a hard time understanding the concept. To me it is like giving a brush to Michelangelo and ask him to paint as fast as possible the ceiling of the Sistine Chapel in the Vatican City. Continue reading “First Unique Character in a String”

Partition Labels in Java

I was planning on working a couple blocks (a block entails 2 hours) on this post but ran out of time. The reason for it is that I will be collaborating with a group by posting some of their articles in my blog. It appears that the group uses Google Docs to create the text for their posts. For text I use Microsoft Word and for diagrams Microsoft Visio.

I have never before directly included a Google Docs on WordPress. That is the reason I had to learn the process, and check for possible caveats. That took some additional effort and time. If interested it seem that the section Use Google Docs to Post to WordPress on Resource Center provides the necessary steps.

Posting to WordPress from Google Docs is easy with the add-on for WordPress.com (Jetpack). 
Before continuing, make sure you have a free Google/Gmail account, 
that Jetpack is installed and configured on your WordPress site, 
and that you have registered with a WordPress.com account through Jetpack.

Make sure you take into accounts the prerequisites paragraph in the section in question. I just made sure I complied. At this time I am using the FREE version of Jetpack for WordPress. I am considering a paid subscription but have not committed to it yet. Continue reading “Partition Labels in Java”