Advertisement
Guest User

Untitled

a guest
Mar 28th, 2018
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement