Showing posts with label Dictionaries and Hashmaps. Show all posts
Showing posts with label Dictionaries and Hashmaps. Show all posts

Sunday, February 3, 2019

Hash Tables: Ransom Note - Hacker Rank Solution

Check out the resources on the page's right side to learn more about hashing. The video tutorial is by Gayle Laakmann McDowell, author of the best-selling interview book Cracking the Coding Interview.
Harold is a kidnapper who wrote a ransom note, but now he is worried it will be traced back to him through his handwriting.

Frequency Queries - Hacker Rank Solution

You are given  queries. Each query is of the form two integers described below:
-  : Insert x in your data structure.
-  : Delete one occurence of y from your data structure, if present.
-  : Check if any integer is present whose frequency is exactly . If yes, print 1 else 0.

Count Triplets - Hacker Rank Solution

You are given an array and you need to find number of tripets of indices  such that the elements at those indices are in geometric progression for a given common ratio  and .
For example, . If , we have  and  at indices  and .

Sherlock and Anagrams - Hacker Rank Solution

Two strings are anagrams of each other if the letters of one string can be rearranged to form the other string. Given a string, find the number of pairs of substrings of the string that are anagrams of each other.

Two Strings - Hacker Rank Solution

Given two strings, determine if they share a common substring. A substring may be as small as one character.
For example, the words "a", "and", "art" share the common substring .
Powered by Blogger.