From what I understand they were written entirely by Grant, Twain paid him and published the memoirs.
Twain had great admiration for Grant and tried unsuccessfully initially to get him to write his memoirs.
Only after Grant was ruined financially by a Bernie Madoff of the 1880's did he agree to write them. Prior to this agreement Grant had submitted a few articles for publication and discovered he had a liking for writing.
Twain did not want to see Grant spend his final years in poverty so probably overpaid him to write the book.
It is my understanding that he began writing the memoir prior to becoming seriously ill although during the last part of completing he did get very ill. He refused to take pain medication because he felt it would cloud his mind when writing. He died 3 days after completion of the memoirs.
Cause of death was throat cancer caused by his love of cigars, he was said to smoke 10-20 a day during the Civil War.
Thank you very much. Yes, I knew he died of throat cancer. There is a famous photo of him sitting on his front porch in a rocking chair, all bundled up, from his last days.