Days in Month – Java

In this post we will compute the number of hours in the specified month and year. This could be used to determine the cost for a feature if enabled every day for a specified month and year.

If one rounds up all months to have a fixed set of days, the result would not be correct. For example, a year has 12 months. Most months have a fixed set of days e.g., Jan, Mar, May, Jul, Aug, Oct, and Dec always have 31 days while Apr, Jun, Aug and Nov always have 30 days. This is not the case with Feb which on regular years it holds 28 days but on leap years it holds 29 days. Continue reading “Days in Month – Java”

Interval HashMap

A couple weeks ago, during a meeting, someone mentioned an interval hashmap. I decided to check if Java had a class implementing a version of an interval hashmap. As you can imagine, it does and is called NavigableMap.

In this post I explored some of the features available in the NavigableMap interface.

If interested, I would suggest to first take a look at the Interface NavigableMap<K, V> in the Oracle Java documentation which can be found here.

After reading the Oracle documentation and some articles in GeeksforGeeks and StackOverflow I decided to start experimenting. Continue reading “Interval HashMap”

Binary Tree Upside Down

Today is Sunday. As usual I woke up at 06:00 AM and it was dark. I decided to stay in bed for a few minutes before getting up and fixing breakfast for my wife and me. The next thing was waking up around 06:45 AM. The day was clearing some, but still dark enough to require artificial light. I understand that if you fall asleep after your alarm clock goes off, that it is an indication from your body that you need additional sleep. That said; I do not recall doing much yesterday. Go figure!

As usual, for breakfast I make espresso on our Bialetti 6-cup Moka pot. Growing up my parents owned several Moka pots of different capacities. Some were used on a daily basis and others when my parents entertained family and friends. With time my mother started using a drip pot. She liked to get the first few drops and add some hot water. It was almost impossible to drink it straight up. Continue reading “Binary Tree Upside Down”

Longest Palindromic Substring

Good day! Hope your day has started on the right note. The days are getting shorter. Every morning after breakfast my wife and I head out for a 2.5 mile walk. We are leaving home a few minutes before 07:00 AM because earlier is dark. We prefer walking with day light. Continue reading “Longest Palindromic Substring”

Unique Binary Search Trees

It has been raining all day in the Twin Cities of Minneapolis and St. Paul. The good thing is that there has been little lightning. I was going to replace an old UPS that I am using to power my main computer in which I develop all the code for this blog, but it was not necessary. I will replace the UPS over the weekend. Continue reading “Unique Binary Search Trees”

Largest Odd Number in String

Good day! Hope your day has started on the right note. The weather has been behaving somewhat strange this season. We started with very hot days and little precipitation. Such conditions caused many patches of dry grass to appear on lawns all over the Twin Cities of Minneapolis and St. Paul. In the past few days it has been raining on and off. That has helped lawns. I checked the weather forecast for today and my wife and I were planning on having breakfast and then head out for a walk. The forecast was off. We had precipitation for the first few hours, so after breakfast I showered, got dressed and went down to my home office.

In a previous post I mentioned that I was going to participate in a weekly programming contest. The contest was scheduled for last Saturday. When I woke up we had rain and thunderstorms. In the past decade or so I have lost two KVM switches. After replacing the second switch I decided to shutdown all my computers when there is a thunderstorm in the area. I canceled my participation in the contest. Will check if there is one this weekend. Will let you know my findings. Continue reading “Largest Odd Number in String”

Divisor Game

It is Thursday and the workweek is almost done. Continue to walk with my wife every morning unless it is raining. Today it was 75F and 75% relative humidity. The conditions were not the best, but we completed our walk. On my way back I watered the plants. It takes me less than 5 minutes.

The lawns in the neighborhood have patches of dried grass. Most lawns have sprinklers but between the heat and the lack of rain, I would venture to say that about 15% of the grass in most (never say all) laws is yellowish indicating it is very dry.

The saga with the presidential elections in Peru continues. Contrary to what the news from American sources (i.e., Reuters, The Guardian, and The New York Times) state, there has been massive fraud and it seems that the communist candidate will win using fraud. Have we seen this before? Continue reading “Divisor Game”

All Construct – Tabulation

Good day!!! Hope your day is going well. The day started relatively cold at 58F with relative humidity around 93%. The weather, according to my iPhone, was fair. My wife and I did our daily morning walk as soon as we were done with breakfast. On my way back I usually water the plans, but due to the weather conditions, I decided to skip. I will water them tomorrow morning.

In my previous post Can Construct – Tabulation I was not please with the telephone support provided by Delta Airlines. They offer a callback when you are waiting to speak with a representative. For example, a callback was promised while being informed that the wait was about 3-hours long. The callback would be received about 12 hours latter; sometimes in the middle of the night.

It is a fact that airlines were hit hard with the COVID-19 pandemic. Most of them (never generalize) let go a large part of their staff. In the past few weeks things are starting to return to normal with customer service at Delta. Earlier this week I placed a call to change several things on a reservation. There was a delay of about two hours (2:15). I requested a callback and as usual wrote the time I expected a representative to call me. About two hours later, Ronda from Delta called. She was very pleasant. She spent a lot of time (15 minutes or so) to make all the changes I requested. Not only that, but she suggested alternatives that could save me some money and make the travelling experience better. Felt like service was back to pre COVID-19 pandemic. Great job Ronda!!!

You probably have heard of competitive programming. It seems that software engineers need to solve a problem as soon as possible. Sounds good, but imagine if you go for a surgery and the surgeon wants to perform the procedure in the least amount of time. Not sure about you, but I would prefer someone with experience that takes its time and wants to produce the best results, not just finish faster than others. Seems to me like a compromise between quality and time. That said; I will try my first competition on Saturday. Will let you know my findings. Perhaps I will change my opinion. Continue reading “All Construct – Tabulation”

Count Construct – Tabulation

Earlier today I read an article commenting about how the high temperatures are rising all over the USA. In Arizona and Nevada the forecasted highs should be about 115F and 112F respectively. The average temperature for a human adult is around 98F. That is quite warm if you ask me.

Today in the suburb in the Twin Cities of Minneapolis and St. Paul where I reside, we woke up with 72F. At some point we might be getting some rain. The high is forecasted to be 91F and we are still in spring 2021.

My wife and I have breakfast and then head out for a walk. We like to get the workout in first thing in the morning. After returning home, I watered some plants that were replaced outside a week or so ago. I have been informed that I need to water them 3 to 4 days a week for a month or so until the plants adapt to their current location; so far, so good. We do need some rain. The lawns in our area are starting to show some brown spots. We can see and hear the sprinklers in the morning, but seems that laws need additional water. A few good down pours each month would take care of the brown spots. Based on NOAA’s forecast, it is going to be a dry and hot summer for most parts in the USA.

Yesterday I mentioned that I requested a callback from a Delta agent. Based on the information at hand, I was expecting the callback in about two hours. I did receive the call. At that time I had performed enough searches on the web that I had solved the issue before talking with the agent. All is well at this time. Continue reading “Count Construct – Tabulation”

How Sum – Tabulation

Good day gals and guys. It is a nice Monday morning in the Twin Cities of Minneapolis and St. Paul. Believe it or not but the high temperatures in the mid to upper 90s F that we have been getting for the past two weeks this Spring has changed in the forecast for the last 10 days of Spring 2021. The forecast call for highs in the upper 70’s to low 80’s F which represents on average a 20F degree reduction. One way or the other, unless it is raining, my wife and I are planning of getting up before 06:00 AM, having breakfast and then heading out for a daily walk. It seems that every day there are more people out and about early in order to avoid the heat in the afternoon.

Our weekend was uneventful. We walked, chatted with people, and prepared food in the grill. Yesterday we made fish and chips in the grill. We want to master the technique because frying potatoes and fish indoors unnecessarily heats the house and leaves food odors that tend to last for a couple hours after we are done consuming lunch. That said, at work and personal life, the only way to learn and become efficient with different tasks is to read, practice, get feedback, make modifications and repeat! In addition you must like what you do; otherwise it is very difficult to improve.

I continue to install applications on my new iPhone. Hopefully this week I will be done installing some Google apps and hopefully getting the data into the iPhone. Continue reading “How Sum – Tabulation”