stanford algo2 programming assignment 4