[leetcode] twosum (java)
https://leetcode.com/problems/two-sum/ Two Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 풀이법 3가지 1. 중첩 for문을 이용해서 배열의 요소를 차례차례 읽어 간다. => 시간 복잡도 O(N^2)으로 인해 비효율적 2. hashtable을 이용 - 값을 꺼내는데 O(N) 2-i) 아래 예제에서 int[] nums = new int[]{1,2,3,4}; 의 값을 전부 미리 넣어 놓고 값을 찾는다. hashmap에는 ..