Advertisement
Guest User

Untitled

a guest
Mar 28th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.37 KB | None | 0 0
  1. (defun water-on-tower (heights n)
  2.   (let ((subtotal-left (nth n heights))))
  3.   (loop for i from 0 to n do
  4.         (setf subtotal-left (max subtotal-left (nth i heights))))
  5.   (let ((subtotal-right (nth n heights))))
  6.   (loop for i from n to (list-length heights) do
  7.         (setf subtotal-right (max subtotal-right (nth i heights))))
  8.   (min subtotal-left subtotal-right))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement