String to Integer

Last evening I read the news from September 06, 2020 that Steve Jobs widow has donated $500,000 USD to the Joe Biden presidential campaign. In my opinion this is quite interesting. Allow me to describe my train of thought.

Donald Trump has made it clear that he wants to start taxing all companies (including Apple) that manufacture outside the USA (in particular in China). On the other hand, Joe Biden will let companies to continue to import good without paying tariffs.

Most (never say all) large companies do not pay tariffs when importing their good manufactured OUS. The claim by most (once again, never say all) companies is that they are trying to provide US consumers with the best possible product at the lowest possible price. This might sound good to some people. The question is “do you understand what is actually happening”? Continue reading “String to Integer”

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”

Concurrent Skip List Map

Before we start I would like to thanks all of you that have subscribed to my blog. We have reached 2,000 subscribers!!! As a matter of fact, we currently have 2,150 subscribers. Thanks a lot!!!

It is so hard to find real news not politically opinionated. For example, I ran into an article that discussed the AztraZeneca vaccine trial in the UK. Apparently there have been two cases in which people that received the vaccine got severely ill. In both cases the trial stopped until further investigation. In both cases it was determined that the issue was not associated with the vaccine. The trials continued in the UK. Continue reading “Concurrent Skip List Map”

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”

Count Good Nodes in Binary Tree

Yesterday evening I was browsing different sites on my phone.

Found on Medium the article LeetCode 1448: Count Good Nodes in Binary Tree by Pierre-Marie Poitevin. If you follow my blog, you probably noticed that in the past couple weeks I have been looking at recursive problems on the LeetCode web site. So earlier today I decided to give it a try.

Originally I was going to write about load balancers today, but I am in the process of reading the paper: Consistent Hashing and Random Trees: Distributed Caching Protocols for Relieving Hot Spots on the World Wide Web by David Karger, Eric Lehman, Tom Leighton, Matthew Levine, Daniel Lewin, and Rina Panigrahy. As soon as I have time to finish reading it, I will generate a post on load balancers. Continue reading “Count Good Nodes in 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”

Minimum Distance Between BST Nodes

Earlier today I read the article “Changing the clocks is a bad idea — and it should end, sleep experts say” by Jen Smith, CNN. The article makes a case for the USA to eliminate daylight savings time. It seems there is enough science behind the idea.

I am a morning person. I have a wake up alarm in my smart phone to wake up at 06:00 AM every day. Most of the time I get up about an hour early. Of course, in the evenings my wife and I are ready to hit the sack around 08:00 PM. At the start of summer the sun is up before 06:00 AM. At the start of winter, it is dark around 04:30 PM. Continue reading “Minimum Distance Between BST Nodes”

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”

Power of Three

Today seems that it is turning into a beautiful summer Sunday in the Twin Cities of Minneapolis and St. Paul. The high temperature in the suburb where I live is forecasted to get up to 77 F and the day will be sunny. It is almost a carbon copy of yesterday.

My wife and I live in a suburb of the Twin Cities. This area has not been affected by protests from BLM (Black Lives Matter). As you know the last set of riots and lootings started in the city of Minneapolis when a black person dies while in police custody. At the time the mayor of Minneapolis and governor failed to provide basic security and law enforcement and for no reason, many businesses were looted and burned. Those were the facts a few months ago. Continue reading “Power of Three”