Good day! Hopefully your day has started on the right note. Last evening my wife and I watched Ava on Netflix. I like movies with spies and action. Perhaps the plot could have been more realistic and credible. We gave the movie a thumb up.
Earlier today I decided to work on the Facebook coding practice problem Queue Removals. The problem provides a single sample test. In addition, when you run your code, it will be checked against two tests. There are no additional hints. There are no additional tests. Continue reading “Queue Removal in Java”
It is pitch dark in the Twin Cities of Minneapolis and St. Paul. Before calling it a day I decided to try one more practice problem from the Facebook web site. Balance Brackets is a very common problem. In general the idea is that you are given a set of brackets and are sked to determine if the brackets are balanced.
I knew I have solved similar versions of the problem. When done with the code I move to a different computer and type in the contents for the post. I looked up in my web site for the string “balanced brackets” and found Balanced Brackets and Balanced Brackets – Possible Second Attempt. I generated the post in 2016 and 2017 respectively. I guess, we will have a third version. Continue reading “Balance Brackets”
It is a Monday morning and it is garbage collection day so I had to put out on the driveway both bins. The company that provides our development with the service collects every week both garbage and recycle bins. All previous companies that I am familiar with collect garbage every week and recycle every other week. To be honest with you, my wife and I would be fine with recycling once a month and if it was not for the potential for smell during summer, garbage every other week.
Earlier this morning, I saw in my inbox a recommendation for a problem from HackerRank named Sherlock and GCD which maybe solved with a Dynamic Programming approach. Continue reading “Sherlock and GCD”
It is Monday November 09, 2020 and it has been a week since the Election Day and the tally of votes is still being adjusted. What a disaster for the USA and friends.
I am not sure why we are not using a voter ID card and limiting voting in person at the polls on Election Day. No exceptions! I am not implying the obvious, but the changes made to the electoral system this year was an open invitation for fraud. Not sure which part of our government is responsible for making sure elections are legal and trustworthy.
If you disagree with the voter ID card and a secure electronic vote at polling sites I would like to provide you with some facts (not opinions) which seem to be all over the news and social media. When you get a credit card via USPS, for your protection, you are asked to call a toll free number and answer a few questions which would allow the credit company to enable the card so you can start charging on it. Credit card companies / banks do not trust the USPS with money. Continue reading “Java Streams and LocalDate”
It is a rainy Sunday morning in the Twin Cities of Minneapolis and St. Paul. Rain started last evening around 08:00 PM and according to the weather forecast will subside later tonight around 10:00 PM. Not a nice day to be outdoors or grilling.
Last Friday my son mentioned that he would be going shopping on Saturday morning to the Costco Minneapolis Business Center Warehouse. My wife and I decided to join him at 07:00 AM (opening time). We met in the parking lot, donned our gloves and mask, and headed in. We have been at the Restaurant Depot many times, but were nicely surprised with the size of the Costco facility and the variety of items. From now on my wife and I will make the trip from home (30 minutes about 20 miles away) a couple times a month to the Costco in Minneapolis. We believe it is worth the drive.
My wife and I cook and bake. I like to bake deserts, breads and Italian cuisine. My wife cooks lunch during the workdays. We both cook on weekends. We have breakfast which I prepare every day and we both skip dinner. The point that I am trying to make is that we did not start cooking or baking due to the coronavirus pandemic.
Last week we noticed that we were running very low on yeast. We went grocery shopping last Tuesday morning and where not able to find yeast at Costco in Eagan, MN or Trader Joe’s in St. Paul. Back home, I went to Amazon.com and ordered a 2 pound pouch of Red Star dry yeast. The total after taxes (we do have Amazon Prime) came to $24.99 USD. I thought it was expensive but it seems that every one and their brother are baking now a day. The delivery will be sometime tomorrow (Monday).
While at Costco we found lots of Red Star dry yeast in the same 2 lb pouches we ordered from Amazon. That is the same yeast we have been using for over a decade. What we found disgusting was that Costco had the same 2 lb pouches of yeast for under $4.50 USD each. We bought two pouches (totaling 4 lbs) for about $9.00 USD. They should last a year or so. Continue reading “Disjoint Union Sets”
The news is full of articles and posts about the corona virus. Before getting in panic mode, stop by the CDC “Coronavirus Disease 2019 (COVID-19)” web page and get informed.
My wife and I follow and watch several YouTube channels. We are mostly interested in foods to prepare and consume and places to visit on our next holiday. Yesterday we watched a new episode on one channel that deals with food and travel in Sicily, Italy. The channel is hosted by a couple of Americans that have roots in Europe and Italy.
They had some interesting facts about how to make a disinfectant using alcohol, aloe vera and some scents. I was not going to mention the specific video, but as I am going over this post, I feel that it is missing. The video is named “SPECIAL EDITION: Coronavirus update from Sicily!”. Quite appropriate for the times we are living in. Continue reading “Sherlock and Anagrams”
Over the weekend I watched the YouTube video “Dealing with Negative Comments | AMA #3 – Ask Me Anything with Lex Fridman”. I have watched a few of his videos. I do enjoy them to the point that I have subscribed to them. There is one in which Lex interviews Donald Knuth and other where he interviews Andrew Ng. Both videos are over an hour so I will watch them over the weekend.
If you are interested in getting information about Lex Fridman you can find it here or there.
I picked the challenge “A or B” from HackerRank after receiving an email message. I guess that if you solve a few of their problems they like you to continue visiting their site and solving additional challenges. I like to work on one or two a week. I believe it is the only way to learn and / or refresh material. Continue reading “A or B”
Every work day when quitting time approaches (around 05:00 PM) I check my to-do list. One thing I had for the day was to check is there is a method in a Java class to shuffle the contents of an array. This is a nice mechanism to have in your toolbox. For example, if you want to load a binary tree search (BST) and the data is sorted, the tree will basically load like a linked list. In a BST you can typically find an element in O(log(n)). But if the elements were inserted sorted, the search is performed in O(n) which is slower than O(log(n)). In such cases you can just shuffle the array and then load the BST. Continue reading “Shuffle Array – Java”
In this post we will develop a couple methods to collect some information from a binary tree. The first method will be the base, and the second will be an enhancement of the first.
The first requirement is: given a binary tree with double values, compute the sum of all nodes in the tree.
The second requirement is: given a binary tree with double values, compute the sum of all nodes whose values are in a specified range (e.g., [ 10.0 : 15.0 ]). Continue reading “Binary Tree Sum”
Today I decided to solve a HackerRank problem. Randomly I selected The Full Counting Sort. If interested read the requirements. I read the requirements and decided to give it a try.
Based on my experience with this problem you might want to follow my advice. Work on the algorithm and make sure it passes the two sample test cases. Once you are done, submit your solution. If you have a valid approach then chances are that your solution will fail test #5, it will time out. I generated up to three different versions of the countSort() function. I could not get past test #5 because it would time out. I spent time reading the discussions and they did not make much sense. I even bought test #5 for some hackos. By the way, the test includes 1,000,000 strings which I could not download no matter how many times I tried. With this problem do not purchase test #5. You will not be able to run it. Continue reading “The Full Counting Sort”