Intersection of Two Arrays

Good day fellow software developers and engineers! It is a gloomy day in the Twin Cities of Minneapolis and St. Paul. Hopefully the weather is nicer in your neck of the woods.

Today I picked up the LeetCode 349 Intersection of Two Arrays problem. To be honest with you I do not recall why I did it. Due to thunderstorms I had to power down my computers a couple times today. I just lost track of the reason why I picked this problem. Continue reading “Intersection of Two Arrays”

Find K Pairs With Smallest Sum

Happy Monday! Hope your day and week has started on the right note. With travel opening in Europe many are making plans and some are already travelling to Europe. It seems that most countries are eager and hopefully able to receive visitors in a safe manner.

Spoke with my youngest son this morning. He was heading to his office. Since the pandemic started he has been working from home like most people in the world has including me. Since the pandemic appears to be under control in many countries, including the USA, schedules are quickly changing and most people will be full time at the office at their place of work. Some companies will allow more flexibility than before with schedules allowing employees to work one or two days from home. Keep in mind that most studies have determined that face contact and casual meetings are associated with more productivity. Interesting fact, because most of us thought that chatting by the water cooler was a complete waste of time! Continue reading “Find K Pairs With Smallest Sum”

Search in Rotated Sorted Array

It is another nice day in the Twin Cities of Minneapolis and St. Paul. The temperature will be in the low 70s. I noticed in the Weather Channel app on my phone that a warning of brush fires has been issued in this area. Based on the temperatures above than normal and precipitation below normal, it was going to happen sooner or later. Hope we get some needed rain soon.

On a separate note the relationship between Israel and Palestine has taken a wrong turn. The last administration in the US was moving forward and had achieved peace between the parties. With the current administration thousands of rockets has been launched into Israel. Interesting but about 20% of the rockets launched have killed the terrorists that launched them. Hopefully both sides will be able to get to a new agreement. Continue reading “Search in Rotated Sorted Array”

Merge K Sorted Arrays

Good morning! It is once again Saturday morning during the COVID-19 pandemic. Today is March 13, 2021 and the sun is shining in the Twin Cities of Minneapolis and St. Paul. The forecast calls for the temperature to get up to 58F. For this time of the year it is welcomed. Tomorrow it will be a little cooler and daylight savings time starts at 02:00 AM when the clocks spring forward to 03:00 AM. Tomorrow we lose one hour.

A week or so ago I was talking with an engineer about merging a set of sorted arrays. I also generated the post Merge Sorted Array which probably motivated the exchange. If you take a look at the last post, the idea was to merge two sorted arrays. The obvious next step is to consider multiple sorted arrays of the same or different lengths. In that post we considered two approaches. In the first one we add all the elements from both arrays into a priority queue. We then populate the result array with the elements being removed from the priority queue. Continue reading “Merge K Sorted Arrays”

Merge Sorted Array

Good morning!  Hope your day has started on the right note. The high temperature in the Twin Cities of Minneapolis and St. Paul is forecasted to be about ten degrees less than yesterday. BTW, yesterday the temperature went up to 61F which is the highest this year so far. My wife and I were planning on grilling yesterday but one thing and the other and I ended having BBQ Chicken Teriyaki from Trader Joe’s. Tasty but I prefer my wife cooking (just making points).

It seems that COVID-19 vaccinations are starting to pick up Minnesota. We are behind other states but the expectations are high. We need to hit herd immunity as soon as possible. It seems that masks and social distancing will be a good idea for people with or without the vaccine for the near future until there is enough data to understand if we will need periodic vaccine boosters or not. Continue reading “Merge Sorted Array”

Union Find Java

It is Monday morning. Lots of work associated things for the day so this post will be direct to the point.

As I have previously mentioned, I am in the process of reading Algorithms in C Third Edition Parts 1 – 4 by Robert Sedgewick. I finished the first chapter and wanted to experiment with the content in the book. Yesterday I got VSCode on my machine to compile and execute. I thought I was ready to use the IDE in C. It seems that when I created a new project something did not work. I am currently using the MinGW compiler with VSCode. The issue might be associated with it. I decided that over the next weekend I will remove MinGW and will switch to the Microsoft C/C++ compiler. I do a considerable amount of work using Visual Studio Enterprise 2019 IDE. Have been using Visual Studio for a couple decades and I like it. VSCode is quite similar but yet different. Continue reading “Union Find Java”

Dot Product of Two Sparse Vectors in Java

It is Thursday and for a while it was snowing. We received a couple inches of fresh snow. Will see what the weather brings us this weekend. I believe Sunday is going to be the coldest day of this winter so far. We might hit -20F. That said; it appears that the weather forecast changes multiple times a day.

Today my wife was not at home for lunch. I prepare toasts with avocado. Put a dab of butter on a couple slices of ciabatta bread, place them on a cooking sheet and into the oven (set at 400F) they went for about seven minutes. While that was going on, I took out from the freezer a Butter Chicken with Basmati rice tray from Trader Joe’s. As soon as the toast was done I swapped the tray with the chicken. The instructions called for 25 minutes so I consumed the toast with avocado and went back to my office. Continue reading “Dot Product of Two Sparse Vectors in Java”

Shuffle an Array in Java

I have mentioned in recent posts that this year the temperature in the Twin Cities of Minneapolis and St. Paul has not dropped down to 0F yet. Well, that is changing this Sunday. It seems that the high temperature for the day will be -6F and the low -20F. The good news is that according to the forecast, the temperature will increase rapidly in the following days.

Last weekend I spend several hours on work stuff. Hopefully the following weekend will be a normal one. Not sure if my wife and I will be venturing out on the forecasted cold. Continue reading “Shuffle an Array in Java”

Shuffle the Array

This morning talking with one of my sons on Skype, I mentioned an article which I rewetted titled “China’s push to control Americans’ health care future”. My wife and I used to watch 60 Minutes every Sunday evening. About a couple years ago we stopped watching TV. It appeared to us that there was not much to watch. I liked the article. I agree with the points presented. To me the best part is the moneys offered to several states in the USA for a Chinese company to be allowed to offer COVID-19 services. My question is:  Where are the funds coming from? Stop for a moment and think about it… OK, now let’s move to a different subject.

Then the pandemic came. With it we started watching more content from Amazon Prime, Netflix and YouTube. In the past year it seems that two or three times Netflix has increased the price for their base tier by $1 each time. Yesterday I read the article “Why I’m canceling Netflix in 2021” which provides some reasons why you should be dropping Netflix. My wife and I seem to always watch YouTube and in addition Netflix or Amazon Prime. In these days we are favoring movies from Amazon Prime. They seem to have a larger and better selection and the service is part of Amazon Prime. Continue reading “Shuffle the Array”

Contains Duplicate

Good day! It is Thursday morning and it is a typical gloomy and cold winter day in the Twin Cities of Minneapolis and St. Paul. The good thing is that is Thursday. One more day to go to and we can start enjoying the weekend. For most of us the weekend will be 2-days long. It is different from the past two weekends in which most people enjoyed 3 or 4 days off work.

Due to COVID-19 my wife and I just leave home for grocery shopping and healthcare appoints when needed. The good thing is that vaccination has started in the USA and hopefully in a few more months most of us will be vaccinated and can start getting back to normal. We all will see what happens. Continue reading “Contains Duplicate”