Good afternoon! Here's our prompt for today.
A very common interview challenge is to determine how often words appear in a given string or set of strings. Here's a version of this: return a list of duplicate words in a sentence.

For example, given 'The dog is the best', returns ["the"].
Likewise, given 'Happy thanksgiving, I am so full', you would return an empty array. This is because there are no duplicates in the string.
Constraints
- The total length of the string <=
100000 - The string will consist of ASCII characters (may be some or all)
- Expected time complexity :
O(n)wherenare the number of words in the string - Expected space complexity :
O(n)
Try to solve this here or in Interactive Mode.
How do I practice this challenge?
xxxxxxxxxx30
var assert = require('assert');​function findDuplicates(str) { const dupes = []; // fill in​ return dupes;}​try { assert.deepEqual(findDuplicates('The dog is the best'), ['the']);​ console.log( 'PASSED: ' + "`findDuplicates('The dog is the best')` returns `['the']`" );} catch (err) { console.log(err);}​try { assert.deepEqual(findDuplicates('Happy thanksgiving, I am so full'), []);​ console.log( 'PASSED: ' + "`findDuplicates('Happy thanksgiving, I am so full’)` returns `[]`" );} catch (err) { console.log(err);}OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment
Here's how we would solve this problem...
How do I use this guide?


