Answer:
Yes, your answer, nitrogen, is correct (the most appropriate option). However, oxygen is also a correct option.
Explanation:
Nitrogen exists on its own as a diatomic gas. However, it exists as organic nitrogen in nucleic acids such as DNA and RNA (as part of their nitrogenous bases) and in the amino (--) group of amino acids.
Do note that a case can also be made for oxygen as a right option: like nitrogen, it exists as a diatomic gas and can be found in both nucleic acids and in the carboxylic group of amino acids.
Sulfur is not an appropriate option as nitrogenous bases (and nucleic acids) to the best of my knowledge do not contain sulphur although some amino acids like cysteine do.
Carbon is not also an appropriate option because elemental carbon does not exist in gaseous form even though it can be found in both nucleic acids and amino acids.