[LeetCode/Dart] 1 : Two Sum
문제
https://leetcode.com/problems/two-sum/
주어진 리스트에서 두 수의 합이 target인 쌍을 구하는 문제
풀이
완전 탐색으로 접근을 했다가 효율성에서 좋지 못하다고 판단하여 해시맵을 활용하여 문제를 풀이했다.
class Solution {
List<int> twoSum(List<int> nums, int target) {
Map<int,int> hash = {};
var rst = [0,...
studio-pendant.hashnode.dev1 min read