CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 04:14:27 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=eef6a93d9732f278a68868420d72103747c13589ae66b8018c501c2336c6e568a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22v2ZMwVSzxV0GYKZK4PBDmR2V4J_PN8Pa%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d3c53c8f34755c-BLR
; with reduce(defn trap-rain-water [h] (let [max-pos (first (apply max-key - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; with reduce
- (defn trap-rain-water [h]
- (let [max-pos (first (apply max-key second (map-indexed vector h)))
- [left-h right-h] (split-at max-pos h)
- f (fn([[m v] x] (if (> x m) [x v] [m (+ v (- m x))])))]
- (+ (second (reduce f [0 0] left-h))
- (second (reduce f [0 0] (reverse right-h))))))
- ; with loops
- (defn trap-rain-water [h]
- (let [enumerated (map-indexed vector h)
- max-pos (first (apply max-key second enumerated))]
- (+ (loop [m 0 res 0 l enumerated]
- (let [[pos x] (first l)]
- (if (= pos max-pos)
- res
- (if (> x m)
- (recur x res (rest l))
- (recur m (+ res (- m x)) (rest l))))))
- (loop [m 0 res 0 l (reverse enumerated)]
- (let [[pos x] (first l)]
- (if (= pos max-pos)
- res
- (if (> x m)
- (recur x res (rest l))
- (recur m (+ res (- m x)) (rest l)))))))))
Advertisement
Add Comment
Please, Sign In to add comment
-
β
β Make huge profits on trading ββ S
JavaScript | 10 sec ago | 0.25 KB
-
π Instant BTC Profit Method β
Working
JavaScript | 14 sec ago | 0.24 KB
-
ββ
Marketplace Glitch β
Working β
NEVER SEEN...
JavaScript | 19 sec ago | 0.25 KB
-
π Crypto Swap Glitch β
Working
JavaScript | 24 sec ago | 0.24 KB
-
ββ
Exploit 2500$ in 15 Minutesβββ G
JavaScript | 28 sec ago | 0.25 KB
-
π ChangeNOW Exploit
JavaScript | 34 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)ββ X
JavaScript | 37 sec ago | 0.25 KB
-
β Free Crypto Method β
JavaScript | 44 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand