We introduce a simple yet versatile protocol to inverse engineer the time-dependent Hamiltonian in two- and three level systems. In the protocol, by utilizing a universal SU(2) transformation, a given speedup goal can be obtained with large freedom to select the control parameters. As an illustration example, the protocol is applied to perform population transfer between nitrogen-vacancy (NV) centers in diamond. Numerical simulation shows that the speed of the present protocol is fast compared with that of the adiabatic process. Moreover, the protocol is also tolerant to decoherence and experimental parameter fluctuations. Therefore, the protocol may be useful for designing an experimental feasible Hamiltonian to engineer a quantum system.