Contains Duplicate

Good day! It is Thursday morning and it is a typical gloomy and cold winter day in the Twin Cities of Minneapolis and St. Paul. The good thing is that is Thursday. One more day to go to and we can start enjoying the weekend. For most of us the weekend will be 2-days long. It is different from the past two weekends in which most people enjoyed 3 or 4 days off work.

Due to COVID-19 my wife and I just leave home for grocery shopping and healthcare appoints when needed. The good thing is that vaccination has started in the USA and hopefully in a few more months most of us will be vaccinated and can start getting back to normal. We all will see what happens. Continue reading “Contains Duplicate”

Revenue Milestones in Java

Good day ladies and gentlemen. Today is Wednesday January 06, 2021. The claims of electoral fraud in the 2020 presidential elections in the USA continue to be brought up. One way or the other January 20 is about two weeks away. If the claims do not pan out then on that day we will have a new president be sworn in. We will be able to read news without political opinions.

Earlier today my wife fixed a delicious chicken dish with a white sauce with lemon and capers. She served it with rice, baked potatoes and beats. For desert we had chocolate ice cream followed by a triple espresso. That marked the middle of my day. In the afternoon I finished two additional 2-hour blocks. Continue reading “Revenue Milestones in Java”

Pair Sums in Java

Good day to all of you. I believe this is my first post for 2021. That said hope you had a nice holiday season. It seems that COVID-19 vaccinations have been started. Hopefully we will be able to put politics aside and move forward quickly vaccinating all people who are interested in getting the shots. My wife will be checking with our doctor to figure out if we can get on a schedule to get it done in the near future. We know of several people in our families and friends that have already received the first shot. It seems that for them so far so good. Will let you know how it goes after the second one.

We are already in January and the United States presidential inauguration is approaching quickly. That said; the winner of the election is still undetermined. Apparently there has been a lot of fraud committed by one of the political parties. If this is case democracy is out the door in the USA. Hopefully all will be resolved in a friendly manner and the people (if any) that committed fraud will be made accountable. Continue reading “Pair Sums in Java”

Is Permutation

Let’s define the requirements for this algorithm. We are given two sets of integers. The idea is to check if the sets are permutations of each other. If they are, return YES; otherwise return NO.

First let’s make sure we agree with the definition of permutation. For the sets to be permutations we must have the same number of elements in both sets. Each set must have the same counts for each entry. For example if the sets are:

1 2 3 4 5 6

6 5 4 3 2 1

Then we would return YES. Both sets have the same length (six in this case) the numbers are the same on both sets, and the count of each number matches (one in this case).

7 6 5 0 9 7

7 6 1 0 9 7

Given that 5 is in the first set, but not in the second and 1 is in the second, but not in the first, these are not permutations of each other so we would return NO. Continue reading “Is Permutation”

13 to 15 Java Questions

I have noticed that multiple times in a week I wake up and check my phone for the time and it is 04:47 AM. Given that I live in the Twin Cities of Minneapolis and St. Paul, there is some day light at that time. I recall a few years ago when I would get up around 05:00 AM to walk the dogs.

I do have an alarm set for 05:00 AM 7 days a week. In addition I have set an appointment in my Google calendar for the same time. Today after waking up at 04:47 AM I checked the calendar to see if there was a message or notification set for 15 minutes before (04:45 AM). Both notification and email are set for 05:00 AM. Continue reading “13 to 15 Java Questions”

More than a List of Words

When indexing text based word frequency / relevance which may be applicable for web searches, one of the procedures used is to create a term frequency (tf) array followed by an inverse document frequency (idf) one. You can read more about this here.

In a previous post I experimented with some text in order to build hashmaps with the words of sentences (to keep things in perspective for a blog post). In that post I used a string that I copied from a course I took some years ago. The sting was already preprocessed. The text had already been stripped off punctuation marks. Continue reading “More than a List of Words”

Word Pattern

It seems to me that LeetCode (https://leetcode.com/) has more complex challenges than HackerRank (https://www.hackerrank.com/domains?h_r=logo). Their approach to testing the solutions is different. They not only test for correctness but they also check for execution time.

In the next few weeks will concentrate in solving challenges from LeetCode. I will also try to get to weekend competitions if they are relatively early in the day (I am a morning person).

If interested take a look at the requirements for this challenge using the following link:  https://leetcode.com/problems/word-pattern/ Continue reading “Word Pattern”