I felt like doing an algorithm and found this problem on leetcode
Given an array of integers, find two numbers such that they add up to a specific target num
Using HashMap this is also a solution if complexity for search in HashMap will in order of O(logn) then in worst case the complexity will be O(nlogn)
public int[] twoSum(int[] nums, int target) { int [] resultIndex = null; HashMap map = new HashMap(); for(int i=0;i