
Recent Posts
Recent Comments
Archives
Categories
Meta
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/leetcodequestion123wildcardmatching.html The solution basically steps through matches and then if it finds a * wildcard … Continue reading
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
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
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
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 subitems from the current item and … Continue reading
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