This file contains hidden or 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
| def create_map(heights): | |
| max_height = max(heights) | |
| return '\n'.join(''.join('##' if i >= h else ' ' for i in heights) | |
| for h in range(max_height, 0, -1)) | |
| def method_a(heights): | |
| water = 0 | |
| left = 0 | |
| right = len(heights) - 1 |
This file contains hidden or 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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| #include <sys/signalfd.h> | |
| #include <sys/select.h> | |
| #include <termios.h> | |
| #include <sys/types.h> | |
| #include <sys/wait.h> | |
| #include <sys/param.h> //for MAX |
This file contains hidden or 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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| #include <sys/signalfd.h> | |
| #include <sys/select.h> | |
| #include <sys/param.h> //for MAX | |
| typedef struct custom_popen_data { | |
| int pid; |
This file contains hidden or 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
| fd_set active_fd_set,read_fd_set; | |
| FD_ZERO(&active_fd_set); | |
| FD_SET(adapter,&active_fd_set); | |
| FD_SET(STDIN_FILENO,&active_fd_set); | |
| while(1) { | |
| struct timeval timeout = {1,0}; | |
| read_fd_set = active_fd_set; |
This file contains hidden or 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
| cmake_minimum_required(VERSION 2.6) | |
| project (algs) | |
| set (CMAKE_BUILD_TYPE Release) | |
| set (SRC src) | |
| set (INC inc) | |
| set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
This file contains hidden or 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 <string> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <vector> | |
| #include <set> | |
| #include <random> | |
| #include <algorithm> | |
| #include <tuple> | |
| #include <cstdint> |
This file contains hidden or 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 <string> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <vector> | |
| #include <set> | |
| #include <random> | |
| #include <algorithm> | |
| #include <tuple> | |
| #include <cstdint> |
This file contains hidden or 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
| #define NUL 000 /* null */ | |
| #define SOH 001 /* start of header */ | |
| #define EOT 004 /* end of transmission */ | |
| #define ACK 006 /* acnowledge */ | |
| #define BS 010 /* backspace */ | |
| #define TAB 011 /* tab */ | |
| #define CR 015 /* carriage return */ | |
| #define LF 012 /* line feed */ | |
| #define NAK 025 /* no acnowledge */ | |
| #define CAN 030 /* cancel */ |
This file contains hidden or 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 <iomanip> | |
| #include <iterator> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <memory> | |
| #include <chrono> | |
| #include <functional> | |
| #include <cstdint> |
This file contains hidden or 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 <iterator> | |
| #include <vector> | |
| #include <tuple> | |
| #include <stdint.h> | |
| uint64_t merge(int *a, size_t a_len, int *b, size_t b_len) { | |
| int *copy = new int[a_len + b_len]; | |
| int *a_end = a + a_len; |