Various algorithm and code problems