US President Donald Trump says he would prefer to avoid military action to deal with North Korea's nuclear threat, but added that previous diplomatic efforts have failed to pressure Pyongyang from developing its missiles.