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 <vector> | |
#include <algorithm> | |
using namespace std; | |
using edges_t = vector<int>; | |
using graph_t = vector<edges_t>; | |
template <typename T> |
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 <climits> | |
#include <queue> | |
#include "avl.h" | |
namespace { | |
int max(int a, int b) { | |
return a > b ? a : b; | |
} |
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 <vector> | |
#include <cstdarg> | |
#include <climits> | |
using namespace std; | |
int min(int count, ...) { | |
int min = INT_MAX; |
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 <queue> | |
#include <string> | |
#include <map> | |
using namespace std; | |
struct Trie; | |
using trie_t = map<char, Trie*>; |
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 <vector> | |
#include <array> | |
#include <climits> // INT_MAX | |
#include <algorithm> // find | |
using namespace std; | |
using edges_t = vector<array<int, 2>>; | |
using graph_t = vector<edges_t>; |
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 <vector> | |
#include <array> | |
#include <climits> // INT_MAX | |
using namespace std; | |
struct Node { | |
int p = -1; | |
int d = INT_MAX; |
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> | |
void swap (int* arr, int i, int j) { | |
const int temp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = temp; | |
} | |
void heapify (int* arr, int max, int root) { | |
const int left = root * 2; |
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> | |
void merge(const int l, const int m, const int h, int* arr) { | |
const int len = h - l + 1; | |
int* const temp = new int[len]; | |
int i = l; | |
int j = m + 1; | |
int k = 0; |
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
const id = 'RenameChunkPlugin' | |
module.exports = class RenameChunkPlugin { | |
constructor (filenameMap) { | |
this.filenameMap = filenameMap | |
} | |
apply (compiler) { | |
compiler.hooks.thisCompilation.tap(id, compilation => { | |
compilation.hooks.optimizeChunkModules.tap(id, chunks => { |
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
function createElement (name, attrs, ...children) { | |
name = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() | |
const $el = document.createElement(name) | |
if (attrs) { | |
for (const [attr, val] of Object.entries(attrs)) | |
$el.setAttribute(attr, val) | |
} |