Answer:
2 bags
Explanation:
Let the number of bags be b.
Let the number of candies in each bag be c.
The number of bags was 9 less than the number of candies in each bag. That is:
b = c - 9
She bought 22 candies.
This means that The number of candy in each bag multiplied by the numbe of each bag is 22:
b * c = 22
bc = 22
=> (c - 9) * c = 22

Since the number of candies can only be a positive number, c = 11.
Therefore:
b = 11 - 9
b = 2
Katy bought 2 bags of candy containing 11 candies each.