Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun water-on-tower (heights n)
- (let ((subtotal-left (nth n heights))))
- (loop for i from 0 to n do
- (setf subtotal-left (max subtotal-left (nth i heights))))
- (let ((subtotal-right (nth n heights))))
- (loop for i from n to (list-length heights) do
- (setf subtotal-right (max subtotal-right (nth i heights))))
- (min subtotal-left subtotal-right))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement