MIME Type puzzle discussion


Thank you magaiti, i got it. Now it runs flawless through.


Hi! I cant get what is wrong with Large Dataset? My code successfully passes all other tests but falls on this test.

Found: U
Expected: a


I got it!!! Some filename is: filename.yes.pdf
It was a problem!


My code is printing the correct values (Using Java, instruction is “System.out.println(“UNKNOWN”);”, for example), but the test plan is reporting that no output was found.

Console output
Standard Output Stream:
Found: Nothing
Expected: U


To pass “Test 03: Correct division of the extension” you need to return mime type for entry string ".pdf’. Not sure is this right thing to do.


Thanks: I had missed out that reference! :joy:


I don’t fully understand what they are asking for my program to do. Can someone better explain it? Maybe give me more examples of input and expected output. I have no idea where to start with this program, I’ve finished every Easy puzzle except this one and it’s frustrating. Thank you!


You have to print the MIME type of each file according to its extension.


In the IDE, there should be a “list” icon just above the testcases buttons. There you can browse input/expected output for each testcase.


I completed this puzzle using Javascript. I was having trouble with the Large Dataset testcase. I wasn’t quite sure how to convert my for loops into, maps as others have suggested. However, I tried changed all references of .toUpperCase(); to .toLowerCase(); and it passed the testcase. I’m assuming this worked because the large dataset contained mostly lowercase letters, therefore there were less characters to convert.


On C# I used a list of a CustomObject (create a Class in there), and redefined the equals so I could simply do a “contains” on that array. make sure that all the data is on the same case…and it’s enough to make it on time (and 100% points).


For those struggling in Python with the large dataset test, you should have a look at Python dictionnaries :slight_smile:


I have the same issue. Everything seems fine but it fails at the last entry anyway.


I have a problem with “Limit size in extensions” and get only 95% in C. I try to memcpy only 10 bytes after getting each extension. Also for file I check if extension has more than 10 characters and if it’s true I write ‘’\0’ after 10th character in extension. Then I strncmp maximum 10 characters. What I should do to reach this test? It’s srsly frustrating.


Language: C++
Problem: Large Data Set

Okay…here is my logic. I have two functions:

  1. string convertToLower(string str)
    – converts everything to lowercase when it’s read in. (loop over char in string)
  2. map<string, string>::iterator searchByEXT(map<string, string> &EXTandMTmap)
    – compares the extension to whatever’s read after the last period (loop over mime types) and prints mime type if comparison is successful

Then in my main function I have 2 loops:

  1. Reads in extensions and mime types into EXTandMTmap
  2. Reads in the mass of data while converting it to lower case (function) if there is a period, checking the extension (function), and printing unknown if comparison from function is unsuccessful

I really can’t see a way to make this any more efficient but I’m pretty new to coding and this is my first time using maps. Does anyone know of some good tutorials on maps I could look into?? Thanks!!


It was my faulty map knowledge! I was looking at each element individually during the comparison instead of using the built in find() function. face palm


why is .pdf a valid name but .mp3 isn’t? I hard coded the output for the .pdf for testing… and it passed… but the .mp3 filename follows the same rules does it not?


Thanks.By using map,I successed !


A little question from my side as Java Developer. How am I supposed to debug with a debug message like: “Expected: a Returned: U” This occures only on test case 5 and I have no way to debug it in a good way, because I have no clue where the error is sitting or which input line gets the wrong translation. And no the Files with the standard in and outs don’t really help because I would have to reformat the whole text so I could put it into my IDE to debug there.

That was a lot of anger, but still I’m very happy I found this side and have some new code examples to do.
Regards Randalf


Same problem @ Consideration of the case (upper or lower), not able to figure out :frowning: … The provided test case clears, however fails the actual validation.
Tried in Python and JS; still getting stuck. A logic issue in my algo?!?