MIME Type puzzle discussion


#157

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


#158

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

Failure
Found: U
Expected: a


#159

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


#160

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:
UNKNOWN
Failure
Found: Nothing
Expected: U


#161

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.


#162

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


#163

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!


#164

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


#165

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


#166

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.


#167

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).


#168

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


#169

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


#170

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.


#171

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!!


#172

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


#173

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?


#174

Thanks.By using map,I successed !


#175

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


#177

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?!?