LeetCode 1 Two Sum: Imperative C++/Java vs Functional Elixir

java dev.to

First of all, I'm not an Elixir developer, so maybe someone can solve this problem in a more optimal way. You can find the original post here You can find the problem description and solutions in all programming languages supported by LeetCode here The general approach for different programming languages is: For the current nums[i], calculate target - nums[i] Check whether we have seen this number before. If yes, return the two indices. If not, store the current number and its index. W

Read Full Tutorial open_in_new
arrow_back Back to Tutorials