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.
Failure
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:
UNKNOWN
Failure
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!
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
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:
-
string convertToLower(string str)
â converts everything to lowercase when itâs read in. (loop over char in string) -
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:
- Reads in extensions and mime types into EXTandMTmap
- 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 ⌠The provided test case clears, however fails the actual validation.
Tried in Python and JS; still getting stuck. A logic issue in my algo?!?