One-Nearest-Neighbor Search is All You Need for Minimax Optimal Regression and Classification