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
def sort_test_1(): | |
l = [2, 1, 3, 4] | |
sorted_l = dummy_sort(l) | |
assert sorted_l == [1, 2, 3, 4] |
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
def get_all_possible_roasters(roaster): | |
# Rules | |
# Players: 1 PG | 1 SG | 1 G | 1 SF | 1 PF | 1 F | 3 C | 3 Util | 4 BN | |
# Roaster: 1 PG | 1 SG | 1 G | 1 SF | 1 PF | 1 F | 3 C | 3 Util | |
# The task is to create all possible roasters from the given roaster | |
roles = { | |
"PG": 0, | |
"SG": 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
use std::vec; | |
#[derive(Debug, Clone)] | |
pub enum BinaryTree<K, V> { | |
Leaf, | |
Node(Box<BinaryTree<K, V>>, (K, V), Box<BinaryTree<K, V>>), | |
} | |
impl<K, V> BinaryTree<K, V> { | |
pub fn new() -> Self { |
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
Require Import Coq.Strings.String. | |
Require Import Ascii. | |
Local Open Scope nat_scope. | |
Inductive Rope := | |
| Leaf : string -> nat -> Rope | |
| Node : Rope -> nat -> Rope -> Rope. | |
Definition mkRope (s : string) : Rope := |
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
#![feature(is_sorted)] | |
use std::vec; | |
use rand::Rng; | |
fn construct(input: &Vec<char>, realized_vector: &mut Vec<u64>, i: usize, n: u64) { | |
if i == input.len() { | |
realized_vector.push(n); | |
return; | |
} |
This file has been truncated, but you can view the full file.
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
0 | |
0-._.-._.-._.-._.-._.-._.-0 | |
000 | |
00000 | |
0000000 | |
00000000 | |
000000000000000000000000000000000000000000000000000000000 | |
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0.0.1 | |
00101s |
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
prop1 = lambda n : n % 2 == 0 | |
prop2 = lambda n : n % 3 == 0 | |
prop3 = lambda n : n % 5 == 0 | |
inputs = list(range(1, 1000)) |
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
use std::fmt::Debug; | |
use std::fmt::Display; | |
use std::fmt; | |
struct DoubleLinkedList<T> { | |
arr: Vec<T>, | |
valid: Vec<bool>, | |
} |
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
type Color = "blue" | "pink"; | |
type Canvas = Color[][]; | |
const generateCanvas = (): Canvas => { | |
// A Canvas is a 3x3 grid of colors | |
const genColor = (): Color => { | |
return Math.random() > 0.5 ? "blue" : "pink"; |
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
# This script takes a PDF book, splits it into chapters, and saves each chapter as a separate PDF file. | |
import PyPDF2 | |
import re | |
# Open the PDF file | |
pdf_file = open('book.pdf', 'rb') | |
pdf_reader = PyPDF2.PdfReader(pdf_file) |
OlderNewer