Amazon interview question

String to Integer without Libraries