sherlock and anagrams hackerrank solution || Hackerank || Solution in c++ ||
Naive approach : check for no of substrings present then sort them add map them to our unordered_map using key value of string, int (key,value) pair. In this approach we can use sorting to ensure all the pairs are categorized in the same key
Optimized : In above part instead of sorting every time we can create a distinct value for each string, this can be done by assigning a prime value to every char (a-2.b-3...) and then multiply them( ab will be 6 and ba as well) hence it will help us create a key value pair of int ,int .
then we can calculate no of distinct pair of substrings using n(n-1)/2 where n is length of string.
Thanks for stopping by
✨Tags✨
sherlock and anagrams geeksforgeeks
sherlock and anagrams hackerrank solution python
sherlock and anagrams leetcode
sherlock and anagrams youtube
sherlock and anagrams javascript
hackerrank sherlock and anagrams javascript
sherlock and anagrams hackerrank solution java github
hackerrank anagram
sherlock and anagrams hackerrank solution javascript
count triplets hackerrank solution
sherlock and anagrams youtube
making anagrams hackerrank solution in c
sherlock hackerrank
fun with anagrams hackerrank solution javascript
sherlock and anagrams hackerrank javascript
anagram difference hackerrank solution javascript
sherlock and anagrams hackerrank solution python
sherlock and anagrams geeksforgeeks
sherlock and anagrams hackerrank solution java github
string anagram hackerrank solution
anagram hackerrank solution in c
string anagram hackerrank solution python
hackerrank sherlock and anagrams javascript
sherlock hackerrank
#hackerank #Solutions #anagrams #coding #programming
Видео sherlock and anagrams hackerrank solution || Hackerank || Solution in c++ || автора JS Революция
Видео sherlock and anagrams hackerrank solution || Hackerank || Solution in c++ || автора JS Революция
Информация
4 декабря 2023 г. 17:39:42
00:16:45
Похожие видео