Exponential AI Interview Question

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