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 <type_traits> | |
template <typename T, typename P> | |
T qpow( | |
T a, | |
typename std::enable_if<std::is_integral<P>::value, P>::type n, | |
T init) { | |
T ans = init; | |
while (n) { | |
if (n & 1) { |
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 <numeric> | |
#include <string> | |
#include <vector> | |
template <class T> | |
std::string join(std::vector<T> vec, char connector) { | |
if (vec.size() == 0) { | |
return ""; | |
} |
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 <utility> | |
#include <vector> | |
using namespace std; | |
void adjustHeap(vector<int>& v, int l, int r) { | |
int val = v[l]; | |
for (int i = l * 2 + 1; i < r; i = i * 2 + 1) { | |
if (i + 1 < r && v[i] < v[i + 1]) { |
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
C++ 4 hrs 12 mins ███████████████████▏░ 91.3% | |
Roff 11 mins ▊░░░░░░░░░░░░░░░░░░░░ 4.1% | |
SQL 4 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.5% | |
C 2 mins ▏░░░░░░░░░░░░░░░░░░░░ 1.0% | |
XML 2 mins ▏░░░░░░░░░░░░░░░░░░░░ 1.0% |