I hereby claim:
- I am leshow on github.
- I am leshow (https://keybase.io/leshow) on keybase.
- I have a public key whose fingerprint is BC60 5DE6 F939 E0D6 74CA 9189 6878 FBDA B459 783C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| use std::ops::Shl; | |
| #[derive(Debug)] | |
| struct V<T>(Vec<T>); | |
| impl<T> Shl<usize> for V<T> { | |
| type Output = Self; | |
| fn shl(mut self, rhs: usize) -> V<T> { | |
| let l = self.0.len(); | |
| rotate_by(&mut self.0, 0, rhs-1); |
| import Control.Monad | |
| import Control.Monad.ST | |
| import Data.STRef | |
| import qualified Data.Vector as V | |
| -- typical recursive linked list partition | |
| partition :: Ord a => a -> [a] -> ([a], [a]) | |
| partition _ [] = ([], []) | |
| partition val xs = (left val xs, right val xs) |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| import Data.Monoid ((<>)) | |
| data Nat = Zero | Succ Nat |
| fizzbuzz :: Int -> String | |
| fizzbuzz n = fromMaybe (show n) (fizz <> buzz) | |
| where | |
| fizz, buzz :: Maybe String | |
| fizz = "Fizz" <$ guard (n `mod` 3 == 0) | |
| buzz = "Buzz" <$ guard (n `mod` 5 == 0) |
| extern crate crossbeam_utils; | |
| use std::{ | |
| collections::HashSet, | |
| env, | |
| error::Error, | |
| fs, | |
| sync::{Arc, Mutex}, | |
| }; |
| extern crate rayon; | |
| use rayon::prelude::*; | |
| use std::{collections::HashSet, env, error::Error, fs}; | |
| fn main() -> Result<(), Box<dyn Error>> { | |
| let args: Vec<String> = env::args().collect(); | |
| let final_diff: HashSet<String> = args[1..] | |
| .par_iter() |
| module Parse where | |
| import Control.Monad | |
| import Data.Char | |
| import Control.Applicative | |
| data Parsed = Digit Integer | Hex Integer | Word String deriving Show | |
| parseHex :: Parsed -> Char -> [Parsed] |
| module ArrayManipulation where | |
| {-| | |
| Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in your array. | |
| For example, the length of your array of zeros | |
| . Your list of queries is as follows: | |
| a b k |
| #[allow(unused_imports)] | |
| use std::cmp::{max, min}; | |
| use std::{ | |
| error::Error, | |
| io::{stdin, stdout, BufWriter, Write}, | |
| }; | |
| #[derive(Default)] | |
| struct Scanner { | |
| buffer: Vec<String>, |