Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It is faster , but less space efficient .
The thing is - you cannot determine even an approximate size of the resulting vector beforehand .
Sure , the input {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} requires the output vector to have a size equal to 16 elements .
And input {1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8} requires the output vector to have a size equal to 8 elements .
While input {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} requires the output vector to have a size equal to just only 1 element .
Favoring speed over space is generally a good idea , but i think it is also worth knowing when "reserve" can be used with/without drawbacks .
This code is good short and straight to the point. My only question is what does the #include algorithm> #include iterator> and #include unordered_set> do for this code?
Goot solution but why we need #include <unordered_set> here?
You could also call the member function "reserve" on the result vector before doing the unique_copy algorithm. This would mean one heap allocation instead of an unknown number of allocations as the vector grows in size.
You can have a print satement in the begining of your function with all your input data
This test is invalid
There's mentioned: the number of pronouns provided will be equal to the number of Noun Phrases in the sentence
but i get:
'adj adj word adj aux adj word aux aux aux aux adj aux adj aux word n aux adj aux n adj n adj adj word aux adj word n n adj word n adj adj word adj aux n adj aux adj adj adj n adj n n aux aux aux aux n n',
[ '0', '1', '2', '3' ],
{ n: 'N', aux: 'aux', adj: 'adj' }
where number of n is 12 and only 4 pronouns;
Language: js
Tere's something wierd going on with this array joining and ';' in the end
probably should be joined
not like this: "Buy: 263 Sell: 11802; Badly formed 2: CLH16.NYM 50 56 S ;OWW 1000 11 S ;"
but like this: "Buy: 263 Sell: 11802; Badly formed 2: CLH16.NYM 50 56 S; OWW 1000 11 S"
HAHAHHAHAHHA LOL