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
| /* | |
| https://www.hackerrank.com/contests/w5/challenges/kundu-and-tree | |
| */ | |
| #include <cstring> | |
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| #define MAX_N 100010 |
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 <vector> | |
| #include <string> | |
| #include <iostream> | |
| #include <cassert> | |
| using namespace std; | |
| /* | |
| BigInt multiply. Use uchar array to store the binary representation. | |
| 1. It should be unsigned char (not char); | |
| 2. Use carry, and do multiply/add iteratively, this could avoid overflow; |
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
| // TCP Client (Java NIO) | |
| // A minimalistic Java NIO TCP client. Stays always connected. Disconnects and reconnects on any exception in the event handlers (onConnect, onDisconnect, onRead). | |
| package net.bobah.nio; | |
| import java.io.IOException; | |
| import java.net.InetSocketAddress; | |
| import java.net.SocketAddress; | |
| import java.nio.ByteBuffer; | |
| import java.nio.channels.ReadableByteChannel; |
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 <vector> | |
| #include <map> | |
| #include <utility> | |
| #include <iostream> | |
| using namespace std; | |
| class ExMap { | |
| map<int, int> _map; // key to index of _keyVals | |
| vector<pair<int,int>> _keyVals; |
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
| /* | |
| f[i][n] = f[i-1][n-1]*C(n,1) + f[i-1][n02]*C(n,2) + ... + f[i-1][i-1] * C(n, n-(i-1)); | |
| */ | |
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| int base = 1000000007; | |
| typedef long long llong; |
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 <vector> | |
| #include <string> | |
| using namespace std; | |
| /* | |
| Small data test pass | |
| */ | |
| typedef long long llong; |
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
| //248_next_min_number.cpp | |
| // by cydu | |
| #include <iostream> | |
| #include <set> | |
| #include <vector> | |
| #include <string> | |
| #include <sstream> | |
| #include <algorithm> |
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
| /* | |
| by cpcs | |
| */ | |
| #include <cstdio> | |
| #include <vector> | |
| #include <map> | |
| #include <algorithm> | |
| using namespace std; |
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 <vector> | |
| #include <stack> | |
| #include <iostream> | |
| using namespace std; | |
| struct ListNode { | |
| int val; | |
| ListNode *left; | |
| ListNode *right; | |
| ListNode(int _val) : val(_val), left(NULL), right(NULL) {} |
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 <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| struct Road { | |
| int start; | |
| int end; | |
| int val; | |
| }; | |