Add common characters challenge

This commit is contained in:
Jessica Kwok 2021-05-14 16:56:07 -07:00
parent a472f9a6ff
commit 2032eef824
2 changed files with 20 additions and 0 deletions

View file

@ -22,6 +22,7 @@
* [Sort Squares Of An Array](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/sort_squares_of_an_array.rb)
* Strings
* [Anagram Checker](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/strings/anagram_checker.rb)
* [Common Characters](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/strings/common_characters.rb)
* [Jewels And Stones](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/strings/jewels_and_stones.rb)
* [Remove Vowels](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/strings/remove_vowels.rb)
* [Two Sum](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/two_sum.rb)

View file

@ -0,0 +1,19 @@
# Challenge name: Find Common Characters
#
# Given an array A of strings made only from lowercase letters, return a list
# of all characters that show up in all strings within the list
# (including duplicates). For example, if a character occurs 3 times in all
# strings but not 4 times, you need to include that character three times in
# the final answer.
#
# You may return the answer in any order.
#
# Example 1:
#
# Input: ["bella","label","roller"]
# Output: ["e","l","l"]
#
# Example 2:
#
# Input: ["cool","lock","cook"]
# Output: ["c","o"]