I'm not sure how to approach this exercise.
One idea is to derive it w.r.t z, show that there is a min-extremum at $z=f_k$ and then show that for each value from the right and the left of the loss function it is positive which will prove that it is convex.
I never worked with Dirichlet functions, I'm not sure how should I show that it is convex analytically. Can somebody give me a clue/solution path ?