Programming Assignment - Cached inverse implementation