There is NO CONTRADICTION. It is a simple misunderstanding through improper reading of the text:
Ahaziah's age of confirmation
The "problem":
The King James Bible (as well as the majority of "original manuscripts") says of Ahaziah:
2Ki 8:26 Two and twenty years old was Ahaziah when he began to reign; and he reigned one year in Jerusalem.
And it also says:
2Ch 22:2 Forty and two years old was Ahaziah when he began to reign, and he reigned one year in Jerusalem.
The "stock" answer:
The King James Bible and vast majority of "original" manuscripts are obviously wrong. It is a simple copyist error.
The truth:
Look again at the context of 2nd Kings 8:26:
2Ki 8:25 In the twelfth year of Joram the son of Ahab king of Israel did Ahaziah the son of Jehoram king of Judah begin to reign. 26 Two and twenty years old was Ahaziah when he began to reign; and he reigned one year in Jerusalem. And his mother's name was Athaliah, the daughter of Omri king of Israel.
This was eloquently explained in the notes from the Geneva Bible (circa 1599 A.D.). I'll just quote it:
"Which is to be understood, that he was made king when his father reigned, but after his father's death he was confirmed king when he was forty-two years old, as in 2Ch 22:2."
So there you have it.
https://av1611.com/kjbp/faq/ahaziah.html
Ahaziah's age of confirmation
The "problem":
The King James Bible (as well as the majority of "original manuscripts") says of Ahaziah:
2Ki 8:26 Two and twenty years old was Ahaziah when he began to reign; and he reigned one year in Jerusalem.
And it also says:
2Ch 22:2 Forty and two years old was Ahaziah when he began to reign, and he reigned one year in Jerusalem.
The "stock" answer:
The King James Bible and vast majority of "original" manuscripts are obviously wrong. It is a simple copyist error.
The truth:
Look again at the context of 2nd Kings 8:26:
2Ki 8:25 In the twelfth year of Joram the son of Ahab king of Israel did Ahaziah the son of Jehoram king of Judah begin to reign. 26 Two and twenty years old was Ahaziah when he began to reign; and he reigned one year in Jerusalem. And his mother's name was Athaliah, the daughter of Omri king of Israel.
This was eloquently explained in the notes from the Geneva Bible (circa 1599 A.D.). I'll just quote it:
"Which is to be understood, that he was made king when his father reigned, but after his father's death he was confirmed king when he was forty-two years old, as in 2Ch 22:2."
So there you have it.
https://av1611.com/kjbp/faq/ahaziah.html