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”

REST API

It is another average fall day in the Twin Cities of Minneapolis and St. Paul. It is sunny and cold. Two more days for the weekend; not that it matters because we are still in the COVID-19 pandemic. That said things appear to be getting better. Hopefully a vaccine will be available soon and we will all get into a new normal.

I am still reading the book Hacker’s Delight by Henry Warren. I have a couple more chapters that I would like to finish before putting it down and starting Get Programming with Node.js by Jonathan Wexler. As I mentioned a few months ago, I will be working on a storage project for my blog. I will start with the APIs and database interface. I decided to use MongoDB for the metadata and the file system for the data. The server part code will be implemented using Node.js in JavaScript. After we have the base functionality we will split the software to work on multiple servers. Once that is done we will move to place the modules in Docker containers and will manage them with Kubernetes. Once all is well, I will see if we can move it to the Azure cloud. After that we will create and integrate additional features. Continue reading “REST API”

Least Recently Used Cache – Java

It is a gloomy Sunday in the Twin Cities of Minneapolis and St. Paul. The current temperature is 23F. The forecast calls for snow. Looks like a perfect day to stay home and enjoy some good food and watch a couple movies. It is a thoughtful wishing, but at 09:15 AM my wife and I will be heading to Trader Joe’s in St. Paul to get some veggies and bread. Yesterday we made strawberry ice cream. My son requested a few servings for his family. We will be delivering it later this morning. Hopefully the roads will not be too slippery. Continue reading “Least Recently Used Cache – Java”

Coin Change

Hope you are doing well and keeping safe! Last evening my wife and I, after stopping a movie we were watching on Netflix, went to bed. It was still snowing on and off. We were both very tired. Today when we were having breakfast, we noticed that the driveway and path to our door had been cleared of snow. We did not hear a thing. That confirms we were really tired last evening.

One of my best friends (have two sent me the link to the article “Top Universities Took Billions in Unreported Foreign Funds, U.S. Finds”, by the Wall Street Journal. The article is quite interesting. It shows how China is gifting money (there are no free lunches) to top USA learning institutions (mostly Ivy League universities) in order to take / steal intellectual property, allowing China to avoid developing technologies at much higher costs. This was discovered due to the fact that those same institutions have been forgetting to pay the associated gift / donation taxes. Shame on you Cornell University! Continue reading “Coin Change”

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”

Backspace String Compare

It is a Saturday morning in the Twin Cities of Minneapolis and St. Paul. As we have been doing for a few months, my wife and I drove to the Costco store in Minneapolis, met with our son and went grocery shopping. Today we were not able to find Three Berry Blend bags. We got separate bags of strawberries and blueberries. Our son will stop later today at the Costco in Eagan. MN and will see if he is able to find a couple bags of mixed berries and a box of pens that we forgot while in Minneapolis.

This week I watched the Association for Computing Machinery (ACM) webinar “Lessons from COVID-19: Efficiency vs. Resilience” by Moshe Y. Vardi. It seems that the webinar is only accessible if you are an ACM member, which I am. I enjoyed the point he made of efficiency versus resilience not only at the software but also at the political level. At no point he mentioned politicians or political parties. In my opinion, it is a very good one-hour webinar worth your time. Continue reading “Backspace String Compare”

Print a Binary Tree in Vertical Order

Yesterday morning while looking at the news on my phone, I ran into Print a Binary Tree in Vertical Order | Set 2 (Map based Method) by GeeksforGeeks. Without reading the article I just twitted it. I tend to do this with software related articles that call my attention. That way I can go through my Twitter history and read such articles when I have enough time to do so.

By 07:00 AM I was down in my home office ready to experiment and have fun. Most weekend days I work one 2-hour block, buy yesterday my wife and a couple friends were getting together to catch up on things. They sit outdoors on the deck of the house of the gal hosting the gathering in order to keep social distancing due to the COVID-19 pandemic. Since we live in the Twin Cities of Minneapolis and St. Paul, such gatherings should be coming to an end shortly. The high temperature for the following two weeks is forecasted to be in the mid to upper 40’s. That said; today I have enough time for two blocks!!! Continue reading “Print a Binary Tree in Vertical Order”

First Unique Character in a String

It seems that time is passing faster and faster. The reason seems to be the lack of variety in our lives. The COVID-19 pandemic for most has imposed limiting factors for social activities. I do not mind getting on-line with coworkers, friends and family, but nothing beats in-person interactions. Hopefully things will get better in the next few months. It seems that several pharmaceutical companies are moving along with their tests for their vaccines.

I selected LeetCode problem 387 First Unique Character in a String. It is catalogued as an Easy problem. That said, like most things in life, there are different ways to skin a cat, but one is best given your specific circumstances. I get a kick when I read about competitive programming. I have a hard time understanding the concept. To me it is like giving a brush to Michelangelo and ask him to paint as fast as possible the ceiling of the Sistine Chapel in the Vatican City. Continue reading “First Unique Character in a String”

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”