1. A method comprising: obtaining first threshold voltages of one or more memory cells in a memory array, wherein obtaining the first threshold voltages of the one or more memory cells comprises: determining a distribution of the first threshold voltages of the one or more memory cells, and grouping the distribution of the first threshold voltages into N groups based on programming speed; for each memory cell in the one or more memory cells: identifying a target threshold voltage for the memory cell, and determining, based on the first threshold voltage of the memory cell, a number of programming shots to reach the target threshold voltage; applying, to the one or more memory cells, respective number of programming shots determined for the one or more memory cells; and upon applying the respective number of programming shots to the one or more memory cells, verifying whether respective target threshold voltages for the one or more memory cells are reached.