Monthly Archives: June 2019

Leetcode 44: Wildcard Matching

There were some tricky test cases in this problem that meant my original recursive solution was too slow. My second attempt was inspired by this post:http://yucoding.blogspot.com/2013/02/leetcode-question-123-wildcard-matching.html The solution basically steps through matches and then if it finds a * wildcard … Continue reading

Posted in programming | Tagged , , | Leave a comment

Leetcode 43: Multiply Strings

The general steps to do long multiplication are fairly straightforward but the implementation was a bit fiddly. I think it would be easier to to reverse the strings and work on them in reverse, then the least significant index will … Continue reading

Posted in programming | Tagged , , | Leave a comment

Leetcode 42: Trapping Rain Water

This is a tricky leetcode problem. There are a few observations that need to be made. Water traps between two bars and only fills each of those gaps to a volume that is the gap’s height taken away from the … Continue reading

Posted in programming | Tagged , , | Leave a comment

Leetcode 41: First Missing Positive

This is tricky and probably not typical of a real world problem, so I don’t know how useful it is know. Given the criteria of running it O(n) time and only using constant extra space, the only way we can … Continue reading

Posted in programming | Tagged , , | Leave a comment

Leetcode 39: Combination Sum

This is a problem that fits naturally to a recursive solution. I’m not sure how I’d implement without recursion. The recursion automatically does a backtrack to find valid solutions. By starting the search for sub-items from the current item and … Continue reading

Posted in programming | Tagged , , | Leave a comment

Leetcode 37: Sudoku Solver

This was an interesting problem that highlights that sometimes it is better to write an algorithm for a computer to execute in a different way to how we would solve the problem with a human mind. So I first attempted … Continue reading

Posted in programming | Tagged , , | Leave a comment