Skip to content

Instantly share code, notes, and snippets.

View dionyziz's full-sized avatar
🐼

Dionysis Zindros dionyziz

🐼
View GitHub Profile
import operator
from functools import partial
class Node:
def __init__(self, val, left, right):
self.val = val
self.left = left
self.right = right
def lfilter(f, node):
def ask(r):
p <- [0, 1] # define whether we will speak the truth or not
s <- [0, 1] # define "ya" as "yes" or "no" randomly
if r: # question has truthful answer
if p: # we are speaking the truth
if s: # the meaning of "ya" is "yes"
return "ya"
else:
return "da"
else: # we are lying
@dionyziz
dionyziz / blur.cpp
Last active November 21, 2019 13:09
#include <cstdio>
#include <iostream>
#include <cairo.h>
using namespace std;
struct RGBA {
int a, r, g, b;
};
const int bytes_per_row = 4;
diff --git a/construction.tex b/construction.tex
index 79aa218..babee01 100644
--- a/construction.tex
+++ b/construction.tex
@@ -144,11 +144,18 @@ We will now show that the savings from the interlink set technique are significa
We can split it up at some arbitrary index $k \geq 0$:
- \begin{align*}
- \sum_{j=0}^\infty (2^{-i})^j &= \sum_{j=0}^k 2^{-ij} + \sum_{j=k+1}^\infty (2^{-i})^j\\
#include <iostream>
using namespace std;
int main() {
const int N = 10;
int numbers[] = {0, 2, 1, 3, 10, 4, 6, 7, 8, 5};
int answer = 0;
for (int bit = 0; (1 << bit) <= N; ++bit) {
def longest_increasing_subsequence(sequence):
best_length = -1
for bitmask in range(2**len(sequence)):
subsequence = []
for bit_idx in range(len(sequence)):
if bitmask & (1 << bit_idx):
subsequence.append(sequence[bit_idx])
if not sorted(subsequence) == subsequence:
continue
if len(subsequence) > best_length:
{
"compilerOptions": {
/* Basic Options */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es2016", "DOM"], /* Specify library files to be included in the compilation. */
"resolveJsonModule": true, /* Allows for importing, extracting types from and generating .json files.
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
const chai = require('chai')
const chaiAsPromised = require('chai-as-promised')
async judge() {
expect(tx.isSane(), 'TX not sane')
.to.be.true
expect(tx.inputs.length, 'TX doesn\'t have 1 input')
.to.equal(1)
expect(tx.outputs[0].value, `TX doesn't pay ${SATOSHI_VALUE / SATOSHIS_IN_BTC} BTC`)
.to.equal(SATOSHI_VALUE)
23.hs:23:3: error:
• Couldn't match type ‘a’ with ‘a0’
‘a’ is a rigid type variable bound by
the type signature for:
rnd_select :: forall a. [a] -> Int -> IO [a]
at 23.hs:18:1-34
Expected type: IO [a]
Actual type: IO [a0]
• In a stmt of a 'do' block: return choice
In the expression:
module RemoveAt where
removeAt :: Int -> [a] -> (a, [a])
removeAt n xs = (item, list)
where item = xs!!(n - 1)
list = map snd (filter fst (zip characteristic xs))
characteristic = before ++ pivot ++ after
before = replicate (n - 1) True
pivot = [False]