This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
-- for each histogram column find maximum height to the left | |
maxima :: [Int] -> [Int] | |
maxima = scanl1 max | |
-- fill with water. level at every column is minimum of | |
-- right and left maximum heights | |
fill :: [Int] -> [Int] | |
fill l = zipWith min (maxima l) (reverse $ maxima $ reverse l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdexcept> | |
#include <iostream> | |
#include <string> | |
#include <boost/thread.hpp> | |
#include <boost/asio.hpp> | |
#include <boost/chrono.hpp> | |
using boost::asio::ip::tcp; | |
boost::asio::io_service io; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <boost/thread.hpp> | |
#include <boost/asio.hpp> | |
#include <boost/chrono.hpp> | |
using boost::asio::ip::tcp; | |
boost::asio::io_service io; | |
tcp::socket sock(io); |