Update Pattern solution code