This Bible contradiction is from the Skeptic's Annotated Bible.
Verses
After forty years
2 Samuel 15:7 View context
And it came to pass after forty years, that Absalom said unto the king, I pray thee, let me go and pay my vow, which I have vowed unto the LORD, in Hebron.
Much less than forty years since David only ruled for a total of forty years.
2 Samuel 5:4 View context
David [was] thirty years old when he began to reign, [and] he reigned forty years.