Efficient and Minimax-optimal In-context Nonparametric Regression with Transformers