LeetCode 79 Word Search in Java

In this post we will tackle the LeetCode 79 Word Search problem using the Java programming language.

Given an m x n grid of characters board and a string word, 
return true if word exists in the grid.

The word can be constructed from letters of sequentially adjacent cells, 
where adjacent cells are horizontally or vertically neighboring. 
The same letter cell may not be used more than once.

Constraints:

o m == board.length
o n = board[i].length
o 1 <= m, n <= 6
o 1 <= word.length <= 15
o board and word consists of only `lowercase` and `uppercase` English letters.

Related Topics:

o Array
o Backtracking
o Matrix

We are given a grid (or two dimensional array) of characters and a string `word`. Our task is to determine if we can find the specified `word` in the matrix following the specified rules. Continue reading “LeetCode 79 Word Search in Java”

Roads and Libraries

Good morning! It is a foggy Sunday morning in the Twin Cities of Minneapolis and St. Paul. In the past week or so the mornings have been sunny. That said, the forecasted high for the day is 76F. If the fog clears and with sun shine we might be a couple degrees warmer.

Yesterday the high temperature was forecasted to be 70F. My wife and I stopped by our older son place. He lives in Lakeville which is about 15 minutes away by car from our place.

We spent a few hours outside chatting and drinking a couple adult drinks while he was cooking some delicious burgers. He enjoys grilling and smoking meats. In the past couple weeks he decided to meet or better yet, improve on a butter burger sandwich from Culver’s.

I am not going to get into the details but in my opinion the burgers he made were a notch better than the ones from the food chain. That said, my wife and I would have cooked them no more than one minute per side. My son likes burgers very well done while we prefer them just done. He did not only cook the burgers, but in addition served them with all the trimmings and in waxed paper in the shape of a bag. We all had a good time. Today my wife and I will grill steaks but next week, we will do burgers with all the trimmings. We will be skipping the paper bag! Continue reading “Roads and Libraries”

Symmetric Tree

Good morning gals and guys! Hope you day has started on the right note. Today in the Twin Cities of Minneapolis and St. Paul we are expecting a high temperature of 67F and the day is sunny. Starting today the two-week forecast shows high temperatures in the upper 60’s to mid to lower 70’s. All looks nice, but we are somewhat low on precipitation. From my backyard I can see a small pond with very low water levels. Hopefully farmers are receiving enough rain to have a good crop this fall.

This morning I watched a session from AWS Summit Online. The session is named “Amazon DynamoDB: Untold stories of databases in a serverless world” by Angela Timofte. She is a data platform manager with Trustpilot. What called my attention were a set of points she brought up which illustrates how important is to allow your technical staff to experiment, learn and make mistakes. Such approach has helped the company move from MySQL to MongoDB and currently to DynamoDB. What is more important, the company currently uses about ten different database engines to store different types of data. They are using the right tools for the jobs (one size does not fit all). If you get a chance take a look at the 22 minute presentation here. Continue reading “Symmetric Tree”

Graph Multiple Costs

Due to the Corona Virus or COVID-19 the entire world is experiencing situations that we have never seen before. The Internet, TV and other news sources are full of reports. Some of them have good and valuable information while most are just opinions which have no scientific background. We should seek information from reliable sources and when possible check our findings against multiple reliable sources and use common sense, which as we know is not the most common of the senses.

Yesterday evening I started this post and wrote about two pages regarding COVID-19. Today started reading it and decided to delete them with the exception of the first sentence. There is already too much information out there. Please stay home. If you need to go out for groceries, please keep social distance. Healthcare facilities are already taking care of more patients that they were designed for. Continue reading “Graph Multiple Costs”

Graph Search DFS and BFS

It is Sunday November 10, 2019 around 10:30 AM. As usual get up at 05:00 AM, prepare and have breakfast with my wife, shower, get dressed and go down to my home office for the first two-hour block of the day. I practice the Deep Work technique methodology by Cal Newport. I have been practicing the technique for years and it seems to work for me.

After the first block of the day I prepared tea and my wife and I sat down in the living room to chat. The high temperature yesterday was 44 F. The high for today is 30 and currently we are at 29. Taking in consideration wind, the wind chill is at 19 degrees. We were considering going out to Trader Joe’s to get some tea which we are running low, but we decided to have an early lunch and watch some movies this afternoon on Amazon Prime and Netflix. Continue reading “Graph Search DFS and BFS”