Skip to content

Ada-C13/Hashmap-Questions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hashmap Exercises

In this set of exercises you will practice solving interview-style questions using hashes.

Due Monday March 30th 7pm

Array Intersection

Design and implement a method that takes two integer arrays with unique values and returns their intersection in a new array.

Note: Do not use the & operator.

For example:

intersection([2, 3, 4], [4, 5, 6]) => [4]
intersection([50, 43, 25, 72], [25, 36, 43, 50, 80]) => [50, 25, 43]
intersection([9, 30, 42], [56, 34, 90, 32]) => []

Check Permutations

Write a method which will take two strings as arguments and returns true if one string is a permutation of the other.

permutations?("hello", "ehllo") => true
permutations?("pasta", "atsap") => true
permutations?("Pizza", "Pasta") => false
permutations?("", "") => true

Could Be A Palindrome

Write a method which takes a string as an argument and returns true if the letters could be re-arranged into a palindrome.

palindrome_permutation?("hello") => false
palindrome_permutation?("carrace") => true # because racecar is a palindrome

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%