rainfall

所属分类:Leetcode/题库
开发工具:Haskell
文件大小:0KB
下载次数:0
上传日期:2013-03-04 23:39:13
上 传 者sh-1993
说明:  我在Haskell.中为Palantir编程挑战提供了一个小而简单的解决方案。,
(My small and simple solution to the Palantir programming challenge in Haskell.,)

文件列表:
.DS_Store (6148, 2013-03-04)
Rainfall.cabal (579, 2013-03-04)
Rainfall.lkshf (261, 2013-03-04)
Setup.lhs (110, 2013-03-04)
dist/ (0, 2013-03-04)
dist/.DS_Store (6148, 2013-03-04)
dist/build/ (0, 2013-03-04)
dist/build/.DS_Store (6148, 2013-03-04)
dist/build/Rainfall/ (0, 2013-03-04)
dist/build/Rainfall/Rainfall (1466772, 2013-03-04)
dist/build/Rainfall/Rainfall-tmp/ (0, 2013-03-04)
dist/build/Rainfall/Rainfall-tmp/Main.hi (9459, 2013-03-04)
dist/build/Rainfall/Rainfall-tmp/Main.o (37004, 2013-03-04)
dist/build/Rainfall/Rainfall-tmp/SDLTest.hi (9671, 2013-03-04)
dist/build/Rainfall/Rainfall-tmp/SDLTest.o (39308, 2013-03-04)
dist/build/autogen/ (0, 2013-03-04)
dist/build/autogen/Paths_Rainfall.hs (1264, 2013-03-04)
dist/build/autogen/cabal_macros.h (969, 2013-03-04)
dist/build/test-Rainfall/ (0, 2013-03-04)
dist/build/test-Rainfall/test-Rainfall (1466772, 2013-03-04)
dist/build/test-Rainfall/test-Rainfall-tmp/ (0, 2013-03-04)
dist/build/test-Rainfall/test-Rainfall-tmp/Main.hi (9459, 2013-03-04)
dist/build/test-Rainfall/test-Rainfall-tmp/Main.o (37004, 2013-03-04)
dist/build/test-Rainfall/test-Rainfall-tmp/SDLTest.hi (9671, 2013-03-04)
dist/build/test-Rainfall/test-Rainfall-tmp/SDLTest.o (39308, 2013-03-04)
dist/package.conf.inplace (2, 2013-03-04)
dist/setup-config (90132, 2013-03-04)
src/ (0, 2013-03-04)
src/Main.hs (2700, 2013-03-04)

rainfall ======== My small and simple solution to the Palantir programming challenge in Haskell. The algorithm is purely functional, so Haskell was a natural choice. As a result, the code is extremely short (64 lines, including comments). The challenge: You are given a matrix of heights, and you assume that water flows over this heightmap in such a way that water currently in one cell always flows to the neighboring cell of least height. Assume that the provided matrix is such that there are no ambiguities in this process. Morever, assume each cell has only four neighbors (E,W,N,S). A sink is a cell with the property that water never flows away from it. The cells which drain water ultimately into a given sink are said to form a basin. Observe that the map is thereby partitioned into basins. Determine the sizes of all basins.

近期下载者

相关文件


收藏者