Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
bad algorithm, the better way is to multiply all number in array, then divide the number in current index to calculate the result. This is a algorithm question, and I don't think the interviewer will really focus on your coding style.