Cody

# Problem 53. Duplicates

Solution 1418864

Submitted on 17 Jan 2018 by Toolman Thoolen
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
strs = {'aa','bb','aa','aa'}; correct = {'aa'}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

uv = 1×2 cell array {'aa'} {'bb'} hits = 3 hits = 1

2   Pass
strs = {'10','11','12'}; correct = {}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

uv = 1×3 cell array {'10'} {'11'} {'12'} hits = 1 hits = 1 hits = 1

3   Pass
strs = {'zzz','zzz','zzz'}; correct = {'zzz'}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

uv = 1×1 cell array {'zzz'} hits = 3

4   Pass
strs = {'a','b','c','b','d','c'}; correct = {'b','c'}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

uv = 1×4 cell array {'a'} {'b'} {'c'} {'d'} hits = 1 hits = 2 hits = 2 hits = 1

5   Pass
strs = {}; correct = {}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

uv = 0×1 empty cell array
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://it.mathworks.com/matlabcentral/cody/problems/53-duplicates/solutions/1418864", "fetch_time": 1582078619000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2020-10/segments/1581875143963.79/warc/CC-MAIN-20200219000604-20200219030604-00342.warc.gz", "warc_record_offset": 433551535, "warc_record_length": 15794, "token_count": 399, "char_count": 1298, "score": 3.640625, "int_score": 4, "crawl": "CC-MAIN-2020-10", "snapshot_type": "latest", "language": "en", "language_score": 0.22199647128582, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00023-of-00064.parquet"}