Monthly Archives: September 2014

Halloween Party Problem Solution in Lisp

The problem: Alex is attending a Halloween party with his girlfriend Silvia. At the party, Silvia spots a giant chocolate bar. If the chocolate can be served as only 1 x 1 sized pieces and Alex can cut the chocolate bar exactly K times, what is the maximum number of chocolate pieces Alex can cut […]

Solution to Gem Stones Problem Using Lisp

The problem: My Solution in Common Lisp (defun processString (line position)   (if (< position (length line))     (progn       (setf (nth (- (char-code (char line position)) 97) gemArray) (+ (nth (- (char-code (char line position)) 97) gemArray) 1))       (processString line (+ position 1))     ))) (defun outputResult (position n)   (if (< position 26)     (if (eql (nth position gemArray) […]

Utopian Tree Solution Using Lisp

The following problem comes from HackerRank: —– The Utopian tree goes through 2 cycles of growth every year. The first growth cycle of the tree occurs during the monsoon, when it doubles in height. The second growth cycle of the tree occurs during the summer, when its height increases by 1 meter. Now, a new […]