View puddle.py
def puddle(xs): | |
result = 0 | |
unresolved = [] | |
for i in range(len(xs)): | |
y = xs[i] | |
if len(unresolved) > 0: | |
while y > unresolved[-1][0]: | |
z = unresolved.pop()[0] | |
if len(unresolved) == 0: | |
break |
View mathcaps.c
/* | |
Compile: make mathcaps | |
Usage: ./mathcaps "the string to convert" | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char** argv) { |