Yesterday I was talking with a coworker about the time it takes (me) to produce a post in this blog. Towards the end of the day, after a nice walk with my wife, I developed the code for this post. My inspiration came from a YouTube video by Irfan Baqui. I am a firm believer that in order to verify you understand some subject, you need to write about it. The reason for writing is that one explains the subject to the reader. Continue reading “Queue implemented with Stacks”
Logged into LeetCode and had the site automatically select a challenge for me. It selected Remove Linked List Elements (https://leetcode.com/problems/remove-linked-list-elements/).
Please visit the LeetCode web site to get the description of the challenge. This challenge has a difficulty level set as easy. Continue reading “Remove Linked List Elements”
I enjoy coding challenges. It makes me think outside my daily work routine. Last weekend I received the following email message from HackerRank:
Improve your skills with this challenge recommended for you:
Data Structures | 2,031 submissions
Print the correct order of plates.
The HackerRank team
This entry touches on the use of a Trie to look up complete or partial words from a specified set. In general Tries are typically used to look up completion words for a prefix (perhaps there are simpler and faster ways to implement such task). To learn more about the challenge please take a look at the following link: https://www.hackerrank.com/challenges/contacts.
Before we get into the code, I have copied and annotated part of the text from the following link: Continue reading “Contacts without a Trie”
Have been somewhat busy in the past couple weeks. To add to it, last weekend I started an on-line “Spring” course. Classes run for three hours Saturdays and Sundays for one month. Need to get the assignments done in the next couple days.
A couple weeks ago I was talking with a manager about prefix searches. At the time I mentioned that I always take a quick look on the Internet to get a general idea on what to do. I did so and Tries came up as an initial candidate. I wrote a blog about it. I tend to be quite passionate with my work and computer science in general. I went and spent some time solving a challenge All Domains -> Data Structures- > Trie -> Contacts on HackerRank (https://www.hackerrank.com/challenges/contacts). Continue reading “Contacts with Trie”
Yesterday evening I was talking with a software manager about an algorithm to autocomplete words. The idea was to build a data structure that could help (hint) users with the available words that would match what has been entered so far. For example, if someone would be looking for my phone number in a company directory application and would have entered “can” then the autocomplete feature could display “cane” and “canessa”. Continue reading “Autocomplete”
It is a beautiful Sunday morning in Minneapolis, MN part of a long Labor Day weekend. Spent some time in the past couple days working on solving a HackerRank problem named QHEAP1. I want to discuss my approach and the reason I solved the problem twice. No, it was not get double points solving the same problem. I do not believe you can do that. Once a problem is solved it is flagged.
I always tend to refresh my knowledge (in this case) or learn about a new topic in order to better understand it before attempting to design a solution. You would be surprised how many people just looks for a solution on-line and never understand what they did or the ramifications if it is not just a standalone problem (i.e., HackerRank) but it is part of an application or system. Continue reading “Binary Heap or Priority Queue”
Yesterday I was looking at a problem on the HackerRank web site. The title is “Self Balancing Tree”. The challenge is to write the insert() function / method in such a way to insert new elements and keep the binary search tree balanced. As usual, no matter how familiar the subject might be, I always research the subject before planning a solution. By doing so I refresh my knowledge and in many cases learn one or more things. To research I try to use Google research and go for Wikipedia articles. Based on what I find I tend to go into different on-line articles or books. Continue reading “AVL Tree”