mirror of
https://github.com/TheAlgorithms/Ruby
synced 2024-12-26 21:58:56 +01:00
Add common characters challenge
This commit is contained in:
parent
a472f9a6ff
commit
2032eef824
2 changed files with 20 additions and 0 deletions
|
@ -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)
|
* [Sort Squares Of An Array](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/sort_squares_of_an_array.rb)
|
||||||
* Strings
|
* Strings
|
||||||
* [Anagram Checker](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/strings/anagram_checker.rb)
|
* [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)
|
* [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)
|
* [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)
|
* [Two Sum](https://github.com/TheAlgorithms/Ruby/blob/master/data_structures/arrays/two_sum.rb)
|
||||||
|
|
19
data_structures/arrays/strings/common_characters.rb
Normal file
19
data_structures/arrays/strings/common_characters.rb
Normal 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"]
|
Loading…
Reference in a new issue