In this post we will solve the LeetCode 1347 Minimum Number of Steps to Make Two Strings Anagram problem using Java.
You are given two strings of the same length s and t.
In one step you can choose any character of t and replace it with another character.
Return the minimum number of steps to make t an anagram of s.
An Anagram of a string is a string that contains the same characters with a different (or the same) ordering.
o 1 <= s.length <= 5 * 10^4
o s.length == t.length
o s and t consist of lowercase English letters only.
o Hash Table
It seems that in this problem it is needed to replace the minimum number of characters in string `t` with lowercase characters from the English alphabet in order to make `t` an anagram of string `s`. Continue reading “LeetCode 1347 Minimum Number of Steps to Make Two Strings Anagram in Java”
In this post we will attempt to solve the Codility_ problem Fish (https://app.codility.com/programmers/lessons/7-stacks_and_queues/fish/) in which we are given N voracious fish are moving along a river. Calculate how many fish are alive. Continue reading “Codility_ problem Fish in Java”
It is Friday and a week since the problem with our furnace showed up. We have switched service companies. We are now going to replace the furnace. Have not heard from the technician yet. Hope to have the new unit installed earlier next week. The temperature in the Twin Cities of Minneapolis and St. Paul is slowly going down.
Due to the COVID pandemic, I stopped donating blood to the Red Cross. For the past decade or so, I have been giving blood twice a year. I do it once for my wife and the second for me. Not sure if we will ever be in need of blood, but I am aware that it is constantly needed. My next appointment is towards the beginning of November. Continue reading “Rotate Array”
Good day! Hope your workday has started on the right note. Currently in the USA we are observing the Daylight saving time which this year ends on Sunday, November 7, 2021. Today is Thursday October 14, 2021 so we have a little over one month for the time to get back to normal.
I see the positive sides of daylight savings time during summer. In my opinion, in the USA, daylight savings should start on Memorial Day and end on Labor Day. The reason for this is that schools and universities tend to be off during such period.
For college students it should not make much of a difference, but for K-12 students it does. Most children use public school buses to commute to school. Depending on the grade they attend, they may be picked up in the morning around 07:00 AM. I am always up before 06:00 AM. I am a morning person. After fixing breakfast I wake up my wife so we can have the first meal of the day together.
After we are done with breakfast, she helps me with the dishes. After rinsing the dishes and putting them in the dishwasher I shower, get dressed, and head down to my office to work on my first 2-hour block of the day. This includes weekends in which I work one or at most two blocks. On regular workdays I tend to do four to five blocks a day.
For the past week or two, when I head down to my office, the day is very dark, to the point that I have to turn on lights. It happens that when I am heading down is about 07:00 AM and I see kids that are already riding public school busses. They had to walk from home to the bus stop while it is quite dark. I thought that children were first in our society. It seems I am wrong. Go figure!
In the month that we have to wait before daylight savings ends, it will be dark close to 08:00 AM. So why is this happening? Well, the thought is that if the school day ends with some light, parents will be more prone to head out and grab a bite which is good for business. I guess children do not have much homework in these days. Things have changed since I attended K-12. Continue reading “Divide Chocolate”
Good evening! It is a nice Tuesday evening in the Twin Cities of Minneapolis and St. Paul. My work day is coming to an end and if possible would like to finish and publish this post. Let’s see how it goes.
The days are getting shorter as times goes by. One thing and the other and my wife and I decided to skip the midday walk today. Tomorrow is going to be quite busy for me. We should get back on our routine on Thursday.
I did not have enough time to finish this post yesterday so I will do so today!!!
Very early this morning I read an article in LinkedIn stating that Julio Velarde has accepted the position of Chairman of the Central Reserve Bank of Peru for a fourth 5-year term. I know Julio since we were kids while attending K-12 in the same class. After graduating from school each took separate directions. Julio went back to Peru after studying abroad and has been very successful at what he does. Julio, my best wishes in your current position!!!
On a separate note, I received and read an email message which reminded of my childhood and my mother drinking percolated coffee in the afternoons. She would start the process and will get the first drops of coffee out of the pot and after adding to it very hot water she would enjoy her coffee. We used to call it `ink` because it was a very dark cup of java. Continue reading “Count Triplets”
Once again it is Friday. Time seems to be flying by. The temperature in the Twin Cities of Minneapolis and St. Paul continues to drop. The day light continues to get shorter and shorter. That said; my wife and I are now walking after work. Yesterday afternoon at 05:00 PM CDT was 72F and the day was sunny. Hopefully we will have a few more weeks with similar days. Winter is coming.
No special plans for the weekend. During breakfast this morning my wife and I were discussing if we will grill beef steaks or make pork ribs. I believe we have both in the garage freezer. I am inclined to grilling due to the fact that nice days for grilling outside are coming to an end. We can prepare ribs in the oven in the mid of winter and they taste great.
This morning while browsing LinkedIn I noticed that my son’s best friend has been assigned as Director of Engineering at Apple. Congratulations on your career achievement! Continue reading “Minimum Swaps 2”
This is Thursday and a template summer day in the Twin Cities of Minneapolis and St. Paul. The highs for today have been forecasted in the low to mid 70s F. Overall the temperatures a lower than usual.
Earlier this morning I watched the NewScientist DEBATE “Information and the future of defense” presented by BAE Systems. It was interesting. The panel had a moderator and if I recall four contributors with very good credentials in the topic at hand.
In my humble opinion, cyberwarfare is a very serious threat brought by bad actors which may represent organizations or states. Since they can be very damaging and are constantly morphing, AI should be employed to determine the threat in a very short time (e.g., milliseconds), block it, and bring harm to the actors. There is an old saying, if force does not solve your problem, you are not using enough. I will not go into more detail at this time, but chatting, discussing and signing agreements between good actors will never stop bad ones. Continue reading “Kth Smallest Element in a Sorted Matrix”