Explanation:
As he brought 30 cookies,
working backwards,
30-12 = 18 (cookies he had before buying from the bakery)
18×2=36 (because he ate half of it, so 18 would be the number of cookies he had left after eating half, so double it)
therefore, jack baked 36 cookies