Skip to content

Instantly share code, notes, and snippets.

View leshow's full-sized avatar
🌹

Evan Cameron leshow

🌹
View GitHub Profile
pub fn diff_ways_to_compute(input: String) -> Vec<i32> {
let chars: Vec<char> = input.chars().collect::<Vec<_>>();
parse(&chars).into_iter().map(|tree| tree.eval()).collect()
}
fn parse(input: &[char]) -> Vec<AST> {
let mut res = vec![];
if input.is_empty() {
return res;
}
#[allow(unused_imports)]
use std::cmp::{min,max};
use std::io::{BufWriter, stdin, stdout, Write};
#[derive(Default)]
struct Scanner {
buffer: Vec<String>
}
impl Scanner {
fn next<T: std::str::FromStr>(&mut self) -> T {
#![no_std]
#![no_main]
// pick a panicking behavior
extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics
// extern crate panic_abort; // requires nightly
// extern crate panic_itm; // logs messages over ITM; requires ITM support
// extern crate panic_semihosting; // logs messages to the host stderr; requires a debugger
use cortex_m_rt::{entry, exception, ExceptionFrame};
@leshow
leshow / leak.rs
Last active April 17, 2020 23:41
/// ```bash
/// cargo run --release
/// # in another term
/// flame -p 9953
/// # in another term
/// flame -p 9953
/// ```
use std::sync::atomic::{AtomicUsize, Ordering};