You can use impulse and momentum principles:
Rearrange and integrate:
where = initial total mass of ship plus fuel, and = final mass of ship after all fuel is spent.
Now that you have a value for , you can calculate its final kinetic energy.
To answer the second part it would be best to introduce a variable for the ratio of the ship's mass to the ship + fuel mass. Let , and the KE equation becomes
Now find the value of k that maximizes KE by setting .