Update with pseudocode, solution, and driver code.