diff --git a/XDaysChallenge/90DaysChallenge/Day1 - hashing/group_anagrams.cpp b/XDaysChallenge/90DaysChallenge/Day1 - hashing/group_anagrams.cpp new file mode 100644 index 0000000..d0c27b1 --- /dev/null +++ b/XDaysChallenge/90DaysChallenge/Day1 - hashing/group_anagrams.cpp @@ -0,0 +1,31 @@ +// https://leetcode.com/problems/group-anagrams/ + +/** + * Should now hashing and how to use it to reduce O(N^2) complexity +*/ +class Solution { +public: + vector> groupAnagrams(vector& strs) { + + unordered_map> store; + + vector copyStrs = strs; + + // sort all of them + for(int i=0;i itemPicked(strs.size(), false); + // now compare + vector> result; + + for(int i=0;isecond); + } + return result; + } +}; \ No newline at end of file