LogicManager interview question

Short word problem