Intel Corporation Interview Question

Design almost the same algorithm in software.