Maximum Score of a Good Subarray

Good morning. Hope your day has started on the right note. If you follow this blog you have noticed that I recommend social distancing in order to reduce the chances of COVID-19 to spread in your local community. My wife and I wear a mask when we go shopping. As soon as we return to our vehicle we remove the mask and apply had sanitizer to our hands. We are planning to continue this behavior for the foreseeable future.

My wife has been to the Mall of America a couple times during the pandemic. She and a friend have not been shopping but walking. On each occasion my wife told me that the mall was almost empty with many stores closed. That is a shame. Continue reading “Maximum Score of a Good Subarray”

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”

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”

Path with Minimum Effort – Java

I have been busy with work, reading and experimenting. So far it has been an interesting and rewarding workweek. That said, I am glad that tomorrow is Friday. Due to the COVID-19 pandemic my wife and I do not have big plans for the weekend with the exception of going out for groceries. I assume that you might be in a similar situation.

I decided to tackle LeetCode problem 1631 Path With Minimum Effort. Sometimes I go for the best approach I can came up with. In this case I kind of stopped before implementing it. My first approach timed out as expected. We will discuss the details. My second approach was accepted with a reasonable time. I still want to get one more pass on it but I just do not have time to get that done now. Continue reading “Path with Minimum Effort – Java”

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”

Number of Islands – Java

Last evening before going to bed, I left a window in the kitchen opened just a crack. The temperature was forecasted to drop down to 37F, so I hopped it was going to be fine.

A few minutes past midnight I woke up. It felt somewhat chilly. I closed the window and checked the temperature in the upper level zone. It was at 68F which is at what we keep it during the winter months. I turned on the heat in the zone and went back to bed. During the rest of the night I heard the furnace kick in a couple times.

During breakfast my wife asked if windows were closed and the furnace was on. I told her about my midnight adventure. We agreed on leaving windows closed from now on until next spring. The system at home has an air exchange unit so it makes sense to keep the windows closed and the temperature at 68F. Continue reading “Number of Islands – Java”

Count Negative Numbers in a Sorted Matrix

UPDATE UPDATE UPDATE

I wish to correct a statement in this post. I mentioned that my wife and I received ballots for the next presidential election. It turns out that the envelopes contain requests for ballots, not the actual ballots. One way or the other we will vote as usual in person at a assigned polling center on Election Day.

I have been reading a few articles regarding the next presidential elections. Some Democrats do not appear to want to use a voter ID to reduce election fraud. The reasons, which you may find on-line, seem to be somewhat childish to say reject a national voter ID registration and card. They are used in most countries.

Due to the COVID-19 pandemic (thanks China), the brilliant idea (I am being facetious) is to have voters mail in their completed ballots using the secure  USPS. In addition you can request a ballot be mailed to you in most (not sure if in all) states. But that is not all, my wife and I live in Minnesota and we have received two (2) unsolicited ballots which we will not use. We will keep them as a souvenir to remember, what I consider, the last nail in the coffin for democracy in the USA.

I am not stating that all people or political parties will commit election fraud. But if you read the news, and we are still about a month away from elections day, fraud is happening all over. Fresh ballots are found in bulk, completed ballots which favor of the Republican candidate have been ditched. What prevents me or any other 3,460,663 registered voters in the state of Minnesota to vote once by mail and a second time in person at a voting site on Election Day? And that is only considering Minnesota.

Election fraud has been around in the US for at least five decades. We have never before seen so much fraud prior to Election Day. So what is going to happen Election Day? After the count of fraud ballots is completed, chances are that there are going to be more votes than registered voters. The elections might be dismissed and we will have to wait a few months or year before a mechanism is deployed (i.e., voter ID) to reduce (eliminate would be too much to hope for) fraud.

All of the turmoil to occur (i.e., riots, protests, looting, lack of groceries) will put the USA at a disadvantage to counter the push of China to dominate and enslave the world (including the USA). Who knows, we might have to buy all Chinese products from Chinese companies (bye bye Apple). We will be forced to work 996 (09:00 AM – 09:00 PM 6 days a week).

Please think before you vote. I personally want to maintain our way of life with some few changes to capitalism and democracy. Continue reading “Count Negative Numbers in a Sorted Matrix”