Red Hat interview question

2Sum code question (can be wrriten in any language)