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
filetype detect | |
set nocompatible | |
set exrc | |
set mouse=a | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set smarttab |
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 <unordered_set> | |
#include <vector> | |
template <typename T> | |
std::vector<std::vector<T>> permute(std::vector<T> vec, int r) { | |
using PermTy = std::pair<std::unordered_set<int>, std::vector<T>>; | |
std::vector<PermTy> permutations{{}}; | |
while (r-- > 0) { |
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 <bits/stdc++.h> | |
template <typename T> struct SegmentTree { | |
std::vector<T> st; | |
int n; | |
SegmentTree(int n) { | |
this->n = n; | |
st.resize(4 * n); | |
} |
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
# assuming we can take 1, 2, or 3 steps | |
n = int(input()) # the number of steps | |
k = int(input()) # the unmber of steps we can take | |
dp = [-1 for i in range(n + 1)] | |
# def number_of_ways(n): | |
# if n == 0: | |
# return 1 | |
# if n == 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 <bits/stdc++.h> | |
using namespace std; | |
/* | |
@author: wilson | |
*/ | |
int main() { | |
ios::sync_with_stdio(false); | |
cin.tie(0); |
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
for i in {1..100} # modify for the number of tests | |
do | |
echo $i | |
./gen > input.txt | |
./code < input.txt > output.txt | |
./brute < input.txt > answer.txt | |
if ! cmp -s output.txt answer.txt | |
then |
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
@echo off | |
for /l %%i in (1, 1, 100) do ( | |
echo %%i | |
gen.exe %%i 4 5 > input.txt | |
code.exe < input.txt > output.txt | |
brute.exe < input.txt > answer.txt | |
fc output.txt answer.txt || goto :out |
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
function longestNonRepeating(a, b, c) { | |
list = [ | |
[a, 'a'], | |
[b, 'b'], | |
[c, 'c'] | |
].sort() | |
if (list[2][0] > list[1][0] + list[0][0] + 1) { | |
return "none" | |
} |
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
public class Solution { | |
static int[] solution(int[] A, int F, int M) { | |
int aLength = A.length; | |
int aSum = 0; | |
for (int value : A) { | |
aSum += value; // sum of values in array A | |
} | |
int totalSum = M * (F + aLength); // the mean multiplied |
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
import java.util.*; | |
public class Solution { | |
public static int[] getMinimumNotesCombination(int targetAmount, int[] notes) { | |
final int INF = Integer.MAX_VALUE; | |
int notesCount = notes.length; | |
int[][] dp = new int[targetAmount + 1][notesCount]; // represents | |
// a combination of notes with minimum sum that gives you some amount |