7 kyu

String matchup

1,861 of 5,044KenKamau

Description:

Given two arrays of strings, return the number of times each string of the second array appears in the first array.

Example

array1 = ['abc', 'abc', 'xyz', 'cde', 'uvw']
array2 = ['abc', 'cde', 'uap']

How many times do the elements in array2 appear in array1?

  • 'abc' appears twice in the first array (2)
  • 'cde' appears only once (1)
  • 'uap' does not appear in the first array (0)

Therefore, solve(array1, array2) = [2, 1, 0]

Good luck!

If you like this Kata, please try:

Word values

Non-even substrings

Algorithms

Stats:

CreatedSep 26, 2017
PublishedSep 27, 2017
Warriors Trained6877
Total Skips125
Total Code Submissions11507
Total Times Completed5044
Python Completions1861
JavaScript Completions2051
Lua Completions189
Ruby Completions189
Haskell Completions98
Rust Completions109
Clojure Completions18
C++ Completions704
Total Stars59
% of votes with a positive feedback rating92% of 868
Total "Very Satisfied" Votes745
Total "Somewhat Satisfied" Votes105
Total "Not Satisfied" Votes18
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • KenKamau Avatar
  • anter69 Avatar
  • imjasonmiller Avatar
  • kazk Avatar
  • Voile Avatar
  • hobovsky Avatar
  • username0 Avatar
  • user8436785 Avatar
  • qmstuart Avatar
  • saudiGuy Avatar
Ad