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”

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”

Analog Clock in JavaScript

It has been over a week since my last post. A lot of things have happened besides COVID-19. As you might know I live in a suburb in the Twin Cities of Minneapolis and St. Paul. I live in Dakota County. On May 24, 2020 the county had experienced 33 deaths due to the pandemic. Today is June 03, 2020 and the count is up to 59. The count is going up. It seems that a second wave has been forecasted by models for about June 15, 2020. As the rate things are going, I would not be surprised. Continue reading “Analog Clock in JavaScript”

Disjoint Union Sets

It is a rainy Sunday morning in the Twin Cities of Minneapolis and St. Paul. Rain started last evening around 08:00 PM and according to the weather forecast will subside later tonight around 10:00 PM. Not a nice day to be outdoors or grilling.

Last Friday my son mentioned that he would be going shopping on Saturday morning to the Costco Minneapolis Business Center Warehouse. My wife and I decided to join him at 07:00 AM (opening time). We met in the parking lot, donned our gloves and mask, and headed in. We have been at the Restaurant Depot many times, but were nicely surprised with the size of the Costco facility and the variety of items. From now on my wife and I will make the trip from home (30 minutes about 20 miles away) a couple times a month to the Costco in Minneapolis. We believe it is worth the drive.

My wife and I cook and bake. I like to bake deserts, breads and Italian cuisine. My wife cooks lunch during the workdays. We both cook on weekends. We have breakfast which I prepare every day and we both skip dinner. The point that I am trying to make is that we did not start cooking or baking due to the coronavirus pandemic.

Last week we noticed that we were running very low on yeast. We went grocery shopping last Tuesday morning and where not able to find yeast at Costco in Eagan, MN or Trader Joe’s in St. Paul. Back home, I went to Amazon.com and ordered a 2 pound pouch of Red Star dry yeast. The total after taxes (we do have Amazon Prime) came to $24.99 USD. I thought it was expensive but it seems that every one and their brother are baking now a day. The delivery will be sometime tomorrow (Monday).

While at Costco we found lots of Red Star dry yeast in the same 2 lb pouches we ordered from Amazon. That is the same yeast we have been using for over a decade. What we found disgusting was that Costco had the same 2 lb pouches of yeast for under $4.50 USD each. We bought two pouches (totaling 4 lbs) for about $9.00 USD. They should last a year or so. Continue reading “Disjoint Union Sets”

First Duplicate

This morning in the Twin Cities of Minneapolis and St. Paul we woke up with a temperature of -11 F. The central heating unit worked overtime last night. It was quite dry indoors. Not sure why this happens due to the fact that the central heating as a built in humidifier and air exchange sub systems.

Yesterday morning I read the article “Do You Solve Programming Problems or Complete Exercises? (The Difference Matters.)” by Amy Haddad. She makes a difference between problem-solving and solving exercises. I agree with her interpretation. If interested read her article and possibly comment in her or my post.

Yesterday evening, I was browsing YouTube and ran into the video “Google Coding Interview Question – firstDuplicate” by Nicholas White. Continue reading “First Duplicate”

Design a System like Yelp

Last week I was talking with a software manager about the design of a feature for Yelp. For starters I am not a Yelp user. If you are like me, you can find more about Yelp in this Wikipedia link.

It seems that Yelp is a business directory and uses a crowd-source review forum to collect information and ratings about different businesses (i.e., barber shops, cinemas, coffee shops, restaurants). It happens that I use OpenTable for restaurant-reservations. Apparently on both platforms one can get nearby restaurants of desired types in a specified distance so you can decide where to go for dinner (or for that matter for any meal at any time) tonight. A side fact, both companies happen to be headquartered in the San Francisco, California area. Continue reading “Design a System like Yelp”

A* Search Algorithm

As I mentioned in my last post, I read the article “A* search: what’s in a name?” by James W. Davis and Jeff Hachtel. If interested, you may find the article in Communications of the ACM, December 2019, Vol. 63 No. 1, Pages 36-37. The article deals with the name of a search algorithm that was originally published in 1968 by Peter Hart, Nils Nilsson and Bertram Raphael of Stanford Research Institute.

My interest was not much about the name but to be able to experiment and understand the algorithm. There are so many algorithms in Computer Science that adding one more to my list is always welcomed. I do not plan on memorizing the algorithm but if the time comes when I might need to search a graph, I will have one more choice in my toolkit. Continue reading “A* Search Algorithm”

Organizing Containers of Balls

Hope you had a happy Thanksgiving Day with your family. As usual there is lots of anticipation and suddenly it is over.

Some years my wife and I have gone out shopping on Black Friday, but as time goes by, it seems that most of the shopping can be done on-line. For that, the best day seems to be Cyber Monday. Besides the ability of shopping from the computer on Cyber Monday, there was a lot of snow and ice over in the Twin Cities of Minneapolis and St. Paul over the Thanksgiving holiday. One of my wife’s nephews posted on Facebook a video of cars slipping and sliding all over in Minneapolis. Continue reading “Organizing Containers of Balls”