30. There are three sets of ten. Each set has codes of 3,3,3,4,4,4,5,5,5,6 digits long (but you get fewer chances each time).
In levels 1-10, there are no duplicate digits in the codes, but duplicate digits appear in levels 11-20 and 21-30, which also make the higher levels more difficult.
You're doing extremely well! Level 20 is a pretty common nemesis. There really isn't a strategy that can guarantee you success on that level. You need a bit of luck too. Same thing starts to happen again in the high 20s.
The good news is that the trophy is available randomly after any level. Your chances do improve at higher levels, but it's not even guaranteed after level 30.
Good luck - you've obviously got it figured out (it's a great thinking game), actually finishing it is just a matter of time, and a little luck.
I have received 1 trophy, but that was when I first started playing the game and was only making it to about level 10 or 11. When I messed up on level 20, it was actually a typo error! All I could do was laugh at myself! My daughter has started to play it too, and for her age, it is a great reasoning skill to learn!