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”

Dynamic Programming Revisited

Today in the Twin Cities of Minneapolis and St. Paul we had snow on and off for several hours. It does not seem we have any accumulation on the road surface. This might change tomorrow. Snow is expected for most of the day. It seems winter has arrived.

A friend mentioned the article “Tokyo citizens may have developed COVID-19 herd immunity, say researchers” by Sally Robertson. If interested, read the article and then continue reading this post… Continue reading “Dynamic Programming Revisited”

Recursive Digit Sum

Yesterday afternoon the technician for a company that cleans ducts showed up for our appointment. Our dryer was having issues with the exhaust duct. We had to clean the dryer filter and restart the unit over a dozen times per load.

The technician arrived half hour earlier. I showed him the location for the exhaust and the dryer. He brought in some type of industrial vacuum and some hoses. I believe he used a camera to watch the operation while vacuuming the duct. Continue reading “Recursive Digit Sum”

Maximum Width of a Binary Tree

This week has gone by so fast; at least it seems so. We have to take into account that Monday was Labor Day so most people, including myself, had the day off. Today is Friday and it is almost lunch time. I am done with a work task, so I decided to get this post done, have lunch and then start the next work task this afternoon.

There is a lot of code, but I generated a candidate for a solution that seemed to work but was too slow to be accepted by LeetCode. Let me elaborate on the specifics. Continue reading “Maximum Width of a Binary Tree”

All Possible Full Binary Trees

Labor Day weekend 2020 is here. The temperatures in the Twin Cities of Minneapolis and St. Paul are getting lower. Given COVID-19, the Minnesota State Fair has been postponed this year. My wife and I are not fair goers. We have been there twice. Our oldest son, who lives in this area, tends to go at least once a year.

Yesterday my wife and I grilled a whole chicken and some steak. There were chicken leftovers for the week. Not sure what we will grill for lunch today. Today the high temperature will be in the lower 80’s. It should be a great day to grill. Continue reading “All Possible Full Binary Trees”

Nth Tribonacci Number

Hope you are having a great day. Apparently I had too much to say out of topic in my last post. Thanks for the message. I will keep it short.

During the workdays my wife prepares lunch while I work in my office. On occasions she asked me to fire the grill to cook the meal. We try to make enough food over the weekends so there are enough leftovers to simplify the process on workdays. That said, it seems that today would have been a great day to grill outside. The morning started at 56 F and the forecast calls for 77 F for a high. The day will be sunny. It seems that it is going to be a perfect day. Continue reading “Nth Tribonacci Number”

Range Sum of BST

Good morning! Yesterday my wife and I grilled some beef, made French fries in an iron pan in the grill and topped it off with some grilled asparagus. We spend the rest of the day making some profiteroles. We explored using a different flower in order for the pastry to not rise much (our oldest son prefers them that way), but the flavor changed. My wife is in charge of the pastry cream which she made. When all was set and done we delivered them to my son who lives in a different suburb of the Twin Cities of Minneapolis and St. Paul.

While driving back, my wife and I were talking about how the social life of people has changed since the COVID-19 pandemic started. We and most of the people when know, are taking care of themselves and others by following social distancing rules, wearing masks and gloves and lately even wearing goggles. We are very tired of the pandemic, but like most people, we need to continue to observer the rules until vaccines are approved and become available to all. Continue reading “Range Sum of BST”

Longest Univalue Path

I have a childhood best friend which we both attended K-12 in the same sequence of schools. We used to hang out on weekends and in some occasions would go out with the family. After high school we both went in different directions. We lost track of each other while attending college. A few years went by and we reconnected. Since then we have visited in person and our spouses appear to have connected well.

Through the years we kept in touch about once a month via Skype. Since the COVID-19 pandemic started, we talk once a week, typically on Friday. We are both morning people so we set the call time between 06:00 AM and 07:00 AM. This morning around 05:00 AM I received a message via Gmail that he had some work appointments early morning. We skipped the call but will reconnect next week. Continue reading “Longest Univalue Path”

Greatest Common Denominator

Last weekend my wife and I visited our son and family who live in Madison, Wisconsin. They like to cook and bake like we do. When I was growing up, most summer days I would make ice cream. The techniques and ingredients were quite simple.

Over the weekend my son made ice cream. He did it using the ice cream bowl for the Kitchenaid mixer. It happens that we also have an ice cream bowl. When we got back, we decided to make some ice cream using the same recipe that our son had used. We searched for our ice cream bowl which we have not used in years, but were not able to find it. We decided to use a regular bowl and the standard 6-wire whip attachment. Continue reading “Greatest Common Denominator”

The Masseuse

!!! UPDATED !!!

Updated the screen capture of the output for the code. The previous one was not displaying correctly.

This past weekend my youngest son and family who live in Madison, WI stopped by for a visit. They used the opportunity to drive to St. Cloud to visit my granddaughter and my older son and family who live in the Twin Cities area of Minneapolis and St. Paul. It is always good to spend time with family. They left for home yesterday afternoon. My wife and I made enough food to feed a lot more people so we will be having leftovers for a few days.

I gave a try to problem 17.16 in the Cracking the Coding Interview book by Gayle Laakmann McDowell. The problem is about a masseuse who has a set of consecutive appointments and wishes to optimize her time by taking care of as many customers as possible with the only caveat that she needs to take a break of 15 minutes within appointments. Continue reading “The Masseuse”