Exponential AI interview question

How does logistic regression work and what is its cost function?