Fibonacci Numbers in C++

In this post we will write a couple functions to generate Fibonacci Numbers using the C++ programming language and the Visual Studio 2022 IDE, on a Windows 11 computer.

The motivation came from the on-line course C++20 Fundamentals by Paul J. Deitel, included in the O’Reilly Learning Platform offered by the Association for Computing Machinery.

C++20 for Programmers
by Paul Deitel and Harvey Deitel
Format:	        Paperback
Language:	    English
ISBN:	        0136905692
ISBN13:	        9780136905691
Release Date:	March 2022
Publisher:	    Pearson Education
Length:	        1008 Pages

I have preordered the new book associated with the course on Amazon. Hopefully it should arrive next month. Continue reading “Fibonacci Numbers in C++”

Best Time to Buy and Sell Stock II

It is a relatively nice day in the Twin Cities of Minneapolis and St. Paul.

This weekend my wife and I will go to visit our younger son. His house is about three hours by car. It does not make sense to fly. It will take longer than driving when you consider the overhead at the airports.

I continue giving it a try to the process to solve dynamic problems using some simple steps as described in the paper Dynamic programming is simple by omgitspavel. Each time I give it a try I add additional guidance.

The main problem that I see with the approach is that one still has to read, understand and explore other methods before diving into dynamic programming. The problem we will be solving in this post can be resolved faster and better not using dynamic programming. Continue reading “Best Time to Buy and Sell Stock II”

Best Time to Buy and Sell Stock with Transaction Fee

Good morning! Hope you had a great weekend. The weekend was not too exiting for my wife and me. We did replenish our freezers for the next few months. I believe we have enough supplies to last us through a good part of spring 2022.

We decided to cook some ribs in the oven. We have done this several times, but due to the fact that my wife is not too fond of such delicacy we have not cooked them in about three years. I pulled the ribs from one of the freezers and put it in a refrigerator for three days. On Friday evening I took them out of the fridge and they were still partly frozen.

On Saturday morning after breakfast I rubbed some salt and pepper on the ribs. Like I mentioned, she is not too fond of ribs or BBQ sauce. I wanted to add some that we got at Trader Joe’s a couple weeks ago. I ended using the sauce on my dish. My wife used an Asian sauce which went very well with ribs. We also bought that sauce at Trader Joe’s.

I was going to set the oven at no more than 300F, but my wife suggested 325F to get them done faster. The ribs went in around 07:00 AM. After showering and getting dressed, I went down to my office for a 2-hour block.

Later that morning my wife and I sat down for a cup of triple espresso. We chatted and decided to get a couple items at a specialty grocery store in St. Paul. We turned off the oven and headed out. In retrospect, we should have removed the ribs from the oven. We had lunch around 01:00 PM and the ribs got a little dry for my taste. We had them with brown rice and black beans. We both enjoyed them, but once a year is enough. The taste is very unique like turkey. We have turkey on Thanksgiving Day and perhaps Christmas. I guess most people do the same in this part of the country.

On a separate note, I ran into the article Was Our Universe Created in a Laboratory? by Avi Loeb published on Scientific American on October 15, 2021. The article starts with the word “Opinion” which puts it into perspective.

I am not going to get into the implications of the ideas in the article. My parents taught me never to discuss religion, money or sex. Such subjects are very opinionated and it is hard to get a general consensus. That said; here we are talking about the article. The reason for me to bring it up is due to the fact that for the past three decades or more, when my wife and I talk in private, I have described to her the idea of multiple universes generated by beings more advanced than us. In such universes there are some actual beings and many artifacts. The idea behind is to study scenarios that in general fall outside our comprehension and interests.

I have to tell you that as soon as I read the article, I ran to my wife to tell her about it. We both thought it was very interesting.

In my thoughts and opinion, the article does not exclude a superior being that is above all levels. It just puts such being above the more advanced civilization(s) that at this point are able to generate universes.

I will try to contact the author of the article and let him know that I really enjoyed reading it. After an hour or so of sending my message to the author, I received a reply. Thanks. Continue reading “Best Time to Buy and Sell Stock with Transaction Fee”

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”

All Construct

It is Saturday morning in the Twin Cities of Minneapolis and St. Paul. According to the forecast today is going to be a scorcher. The temperature will rise to 97F. I live in a suburb of the Twin Cities. Typically the city of Minneapolis gets at least a couple more degrees higher.

Yesterday my wife and I went to the Mall of America which is located in the city of Bloomington. On our way back home the temperature was 102F.

Given the hot spell we are experiencing in this part of the country, this morning my wife and I had breakfast and headed out for a walk. When we got back I was perspiring. After a nice shower I headed down to my office to get in a 2-hour block of work.

Tomorrow Sunday presidential elections will be held in Peru. There are two candidates. One is an open communist and terrorist and the other is pro democracy. Hopefully the elections will favor the right. Politically and economically South America is slowly falling to communism and the economies of most (never generalize) are getting worse by the day. Will see what happens tomorrow during election day. Continue reading “All Construct”

Can Construct

It is Wednesday on a nice and warm day in the Twin Cities of Minneapolis and St. Paul. To be honest with you, it does not matter much if the day is nice or not. I have not been outside today. On the other hand the forecast for Friday, Saturday and Sunday is calling for temperatures in the low 90’s. Hopefully my wife and I will be able to enjoy the days. In particular we are planning on walking early morning so we can avoid the high temperatures. We are planning on grilling and consuming some adult beverages. I believe we are almost out of beer so we might stop by Friday evening after work by the liquor store. Continue reading “Can Construct”

How Sum

Once again it is Friday in the Twin Cities of Minneapolis and St. Paul. This coming weekend is Memorial Day 2021. My wife and I will be heading out after work to visit our younger son. It is about a three-hour drive. Today in the Twin Cities is rather cold. As we reach our destination it might be raining. At least that is what the weather forecast call for today. While driving the temperature is not much of a concern. Rain on the highway is OK as long as we do not encounter thunderstorms. Yesterday evening we filled up the SUV so we are ready to leave at the end of the workday today.

I kept on watching the Dynamic Programming – Learn to Solve Algorithmic Problems & Coding Challenges video on YouTube. I am around the 2nd hour into the video and to be honest with you I am enjoying it.

My wife and I drove back after spending a couple days with our son and family. We have not visit with them in person for the past year and a half. The boys are growing like weeds. We are planning on visiting them before the yearend holidays. They are planning on a trip with friends around Christmas 2021.

On a side note my Pixel 4 cell phone died again while we were out of town. Tried pressing and holding the different buttons but nothing happened. Back home, I tried charging the phone for an hour or so to get some juice in the battery. After repeating the process the phone continues to be dead. Today we have other plans. Will stop by T-Mobile tomorrow and see if they can revive the phone once again. The issue appears to be battery related. Now a day who knows? It might be a virus. One way of the other we are done with Google phones. We are moving to Apple. Will let you know my first impressions as soon as I get the new phone configured to a point I can have what I consider basic configuration. Continue reading “How Sum”

Can Sum?

Today is a cold and dark day in the Twin Cities of Minneapolis and St. Paul. It has been raining all day. The forecast matched the day. Hopefully tomorrow it will be nicer.

Yesterday evening my wife and I were sitting in the living room watching YouTube videos. All was working as expected. At some point I decided to look for a video to watch so I picked up my phone that was sitting next to me on the couch. The phone was dead. I tried powering it up at no avail. I thought the battery might have discharged. Strange because when I picked it up from the wireless charger the phone was about 100% charged.

I tried pressing button sequences to restart the phone. That did not work.

I pulled my cell phone out of the OtterBox case. The phone looks like new. I decided not to open the actual phone thinking I might cause an additional problem. I put my phone back into the OtterBox case.

I then decided to put the phone to charge on a wireless charger. After half hour or so later I tried to power up the phone. It was not able to power up. I then tried with a regular plug-in charger. Half hour later the phone was still completely dead. Decided to take my Pixel 4 phone to T-Mobile and see if they can diagnose and hopefully fix the issue. We will find more about it today after work…

…Later in the day I took my cell phone to the T-Mobile store closest to home. They were able to rest the phone. All is back to normal. I did ask if T-Mobile would carry the Pixel 5 phone. Apparently they have no plans to do so. My wife and I might switch to Apple for the first time when our Pixel phones need to be replaced. Continue reading “Can Sum?”

Fibonacci Revisited

Good day! Hope your day is winding down nicely. We were expecting thunderstorms today in the Twin Cities of Minneapolis and St. Paul, but we just got some rain in an almost sunny and warm day. It seems that this summer is going to be warmer than usual.

I decided to watch Dynamic Programming – Learn to Solve Algorithmic Problems & Coding Challenges which is slightly over 5 hours long. The idea is to watch and experiment as you go. The code on the video is implemented in JavaScript. I decided to use Java.

It is going to take me a few days to watch the entire video and experiment with the code.

On a separate note I am in the process of setting up .NET on a different machine. I want to do so experimentation using the VSCode IDE. I have the same setup on a different machine but I am using Visual Studio Enterprise Edition. More on this as soon as I complete and verify the installation. Continue reading “Fibonacci Revisited”

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”