this is simple balancing. if you are not sure using integer coefficient, why not try fractions?
N2 + H2 -> NH3
2N on LHS and 1 N on RHS, so coefficient of N2 = 1/2
2H on LHS and 3H on RHS, so coefficient of H2 = 3/2
1/2 N2 + 3/2 H2 -> NH3
multiply through out by lowest common multiple of the denominators to convert the fractions to integer.
Solution: N2 + 3H2 -> 2NH3 (multiply by 2 through out)