diff --git a/best-time-to-buy-and-sell-stock/s0ooo0k.java b/best-time-to-buy-and-sell-stock/s0ooo0k.java new file mode 100644 index 000000000..d0e861311 --- /dev/null +++ b/best-time-to-buy-and-sell-stock/s0ooo0k.java @@ -0,0 +1,14 @@ +class Solution { + public int maxProfit(int[] prices) { + int price = prices[0]; + int maxProfit = 0; + + for(int i=1; i> groupAnagrams(String[] strs) { + HashMap> map = new HashMap<>(); + + for(String s : strs) { + char[] c = s.toCharArray(); + Arrays.sort(c); + + String key = new String(c); + if(!map.containsKey(key)) { + map.put(key, new ArrayList<>()); + } + + map.get(key).add(s); + } + return new ArrayList<>(map.values()); + } +} + +