Coin Change 2

Went after the LeetCode challenge Coin Change 2 which you can find at the following URL:

There are two approaches typically used to solve this type of problem. They are:

Dynamic Programming

I consider dynamic programming more of an art than a science. I believe developers need to use it often enough to solve adequate problems to achieve and maintain proficiency in the technique.

I visited the Wikipedia page on Dynamic Programming and took notes which I present in the following couple paragraphs. That is simpler and quicker than starting from scratch ;o) Continue reading “Coin Change 2”

Longest Absolute File Path

A couple strange things are happening to me with this challenge. If you wish to take a look at the requirements and provide some insights you can find it at:

As you can see there are a couple of sample strings. They are:



Allow me to show a screen capture of the Eclipse IDE console: Continue reading “Longest Absolute File Path”

Construct the Rectangle

I chose the following challenge from LeetCode: and gave it a try.

f interested please follow the link to get the requirements.

The following is a screen capture of the console using the sample data:

area:        4 = [L:        2 W:        2]

Please note that the challenge only requires the method constructRectangle(). The test cases were generated by me.

Additional output from the console for additional tests follows: Continue reading “Construct the Rectangle”

Bitwise AND of Numbers Range

What a humbling experience. Picked up at random a challenge at LeetCode (

The requirements are quite brief and one can easily determine what is required:

Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.

For example, given the range [5, 7], you should return 4”.

I got a piece of paper and jotted down the following: Continue reading “Bitwise AND of Numbers Range”

Remove Duplicates from Sorted List II

This challenge comes courtesy of LeetCode:

The challenge is rated medium difficulty. At this time there have been 96,122 accepted solutions from 334,885 submissions. If you decide to tackle the challenge make sure you read it a few times.

On my first pass (which I did not submit) I missed the word ‘distinct’ from the requirements ;o(

On purpose, my solution completely ignores the fact that the list is ‘sorted. If this would have been work or a contest I would have taken such requirement into consideration :o)
Continue reading “Remove Duplicates from Sorted List II”

Valid Parentheses

I have not solved a LeetCode challenge in a couple weeks. Went to the site and the system suggested the Valid Parentheses using the following URL:

The idea is to determine if a sequence of parentheses in a string are properly matched. Please take a look at the actual challenge using the previous URL.

Following is a screen capture of the console on my Eclipse IDE: Continue reading “Valid Parentheses”

Remove Linked List Elements

linked_listLogged into LeetCode and had the site automatically select a challenge for me. It selected 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”