candidate: Magnus Olafsson ( Old Norse : " Magnús Óláfsson " , Norwegian and Danish : " Magnus Olavsson " ; c. 1024 – 25 October 1047 ) , better known as Magnus the Good ( Old Norse : " Magnús góði " , Norwegian and Danish : " Magnus den gode " ) , was the King of Norway from 1035 and King of Denmark from 1042 , ruling over both countries until his death in 1047 .