Tag / programming
[Leetcode] 10. Regular Expression Matching
I came across an interesting leetcode problem and decided to solve it in Python (a language I’m not comfortable with) for practice. Here’s the problem: Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve it in linear time/space. Return 0 if the array contains less…
[Programming] N-queens problem using Haskell
If you’re reading this blog, you’re most likely familiar with the famous N-queens problem. If not, here it is! The eight queens puzzle is the problem of placing eight chessqueens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column,…
Random Integer Interview Question
Note: This post is also on my blog with my fellow programmers Eric and Young. It’s called YES Programming, using our initials. Check it out if you have time! Hello! Sang checking-in. Here’s an interesting problem I found: Given a function which produces a random integer in the range 1 to 5, write a function…