North Korea borders 3 countries: China, Russia, and South Korea. China forms the country’s longest border to the north and northwest, Russia touches North Korea in the far northeast, and South Korea lies directly to the south.
Much of the China–North Korea boundary follows the Yalu, or Amnok, River, while the Tumen River helps define sections of the eastern frontier. North Korea’s border with Russia is very short—only about 18 kilometers—and follows the Tumen River near the meeting point of China, Russia, and North Korea.
The southern boundary is marked by the Korean Demilitarized Zone, created by the 1953 Korean Armistice Agreement. North Korea also faces Japan across the Sea of Japan and has maritime boundaries in surrounding waters, but Japan is not counted among its land-bordering countries. That is why the standard geography answer is three.