MIME Type puzzle discussion


#1

Feel free to send your feedback or ask some help here!


#4

Im curious about the "Consideration of the case (upper or lower)" validation test case, because my solution passes the IDE test case with the same name, but the validation test fails for reasons unknown to me...


#5

What does "Limit size in extensions" exactly mean? My program fails on this test and I have no idea why.
N.B. It passes the "Large dataset" test.


What is the expected behavior for extensions >10 characters
#6

The specification states the maximum length of the extension.
That test probably has a longer than specified extension in it, you should truncate the length of the extension when parsing the MIME types!


#9

What do you mean with "Duplicated MIME types" ? I don't get it.


#12

For the large dataset test, you'll need an efficient algorithm to search for the proper MIME type for a large number of files. If you're using arrays, you aren't using the best container for efficiently searching for MIME types.

If you're using C++ (my programming language of choice), I suggest that you use a map instead of an array. A map in C++ may be called an associative array, hash table, or dictionary in other languages.


#13

Big thanks smile


#16

A map is an easy and efficient solution, which requires less work than yours ^_^. Moreover, what you're proposing is actually a kind of tree map, thus a map wink


#18

What do you mean with "limit size in filenames"?  I don't need to use the filenames at all.
All 5 Test Case pass ok, but the final score is 95%


#19

you should use a map, as described above winkI think that the problem is that your program is too long to give an answer. But we can't be sure as we don't have the data set for the test.

Anyway, That was my problem too, and using a map resolved it wink


#20

sure? If I make a pause of 400ms [ usleep(400) in PHP ] the test goes right, but if I pause for 500ms the test fails in  "Large dataset (300 pts)". So I assume this is the checking for slow program.
"limit size in filenames" have no sense about program velocity check.

Please, any ideas on the "limit size in filenames" check?

EDIT:
The problem was the original input line suggested by the platform:
$FNAME = stream_get_line(STDIN, 256, "\n");

the problem disappeared using this one:
$FNAME = stream_get_line(STDIN, 2560, "\n");


#21

Hi! I am confused by Large dataset test. My script's (I used bash) output is fully identical to given out.txt, but test fails. I can imagine only one problem - performance. Script executes more than 70 seconds...

UPD: Fixed it by the hash-tables solution.


#22

Hi in javascript is something wrong with "Large dataset" test, I got fail without any error, on Console output after line 70 strangely appear this:

text/html
application/json
application/vnd.ms-powerpoint

...
UNKNOWN


#23

If the line with "..." is bothering you, as I said in another topic:

It also applies to the output stream so you can't see the whole response with large dataset tests.


#24

I think that there is an issue in the test data set. For example, I see it fail on this last entry:

iLowerCaseAndUpperCaseLetters.exe>>application/octet-stream
thisistheend.xls>>application/vnd.ms-excel
anotherfiletest.zip>>application/zip
thisisanotherfilename.longextens>>UNKNOWN
iLowerCaseAndUpperCaseLetters.>>UNKNOWN

My code properly handles the fact there is a period with no extension following and it reports UNKOWN yet the test harness reports this is not correct. Makes no sense to me. Is it possible an issue in the Groovy/Java tests?


#25

The test report doesn't tell you where the fail is exactly. Your last line is correct but one or several of other lines might be wrong.


#26

Guys, make sure you make everything correct:

  • have a proper map of mime types (key / value, hash set, or both)
  • have a proper method of extracting extension from file. I forgot about digits and all mp3-s missed.
  • make sure performance is good (which is if you use hashset / generic dictionary)

#27

I presume your program fails on file extensions that have a length of 10 characters.

File extensions are composed of a maximum of 10 alphanumerical ASCII characters.
MIME types are composed of a maximum 50 alphanumerical and punctuation ASCII characters.
File names are composed of a maximum of 256 alphanumerical ASCII characters and dots (full stops).

If you are using a language that requires a 0 character to end a string, you must add that to the maximum length when reserving space.


#28

There may be more than one extension that resolves to the same MIME type.


#29

hi! how you did it?
i'm use BASH too
i can't pass 2 puzzle with BIG DATA (MIME Type & Horse-racing Duals)
tried to use arr[key]=value and arr[]=key:value, but didn't work
i get different steps_count every time in cycle