From NFPA.org
Installing smoke alarms
Choose smoke alarms that have the label of a recognized testing laboratory.
Install smoke alarms inside each bedroom, outside each sleeping area and on every level of the home, including the basement.
On levels without bedrooms, install alarms in the living room (or den or family room) or near the stairway to the upper level, or in both locations.
Smoke alarms installed in the basement should be installed on the ceiling at the bottom of the stairs leading to the next level.
Smoke alarms should be installed at least 10 feet (3 meters) from a cooking appliance to minimize false alarms when cooking.
Mount smoke alarms high on walls or ceilings (remember, smoke rises). Wall-mounted alarms should be installed not more than 12 inches away from the ceiling (to the top of the alarm).
If you have ceilings that are pitched, install the alarm within 3 feet of the peak but not within the apex of the peak (four inches down from the peak).
-----------------
Noteworthy :
Many moons ago, when smoke detectors were first required outside all bedrooms, there was a maximum distance from bedroom doors - 10 feet
That was really objective, and no need to interpret.
But now, it's ambiguously "outside each sleeping area" which could be interpreted as 1 directly outside each bedroom door.
Also, it really doesn't matter what's written in one particular code, it matters what each municipality requires.
Here in KC, there are 2 municipalities that I know of which require a smoke/carbon monoxide detector "in the approach to any bedrooms" and also require smoke detectors updated to most recently adopted cycle in any home where any type of building permit is required.
The bottom line? I call and ask. Every time.