In each case, if Ali had one more apple then he could share them all out equally. So, your answer is one less than the lowest common multiple of 4, 5 and 9. 4, 5 and 9 share no common factors, so their lowest common multiple is simply their product. 4x5x9 = 180, so the minimum number of apples Ali can have is 179.

Check: 179/4 = 44 r 3

179/5 = 35 r 4

179/9 = 19 r 8