Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

MIME2 - Editorial

$
0
0

PROBLEM LINKS

Practice
Contest

DIFFICULTY

EASY

EXPLANATION

The solution proceeds in two steps. The first step is to read and store pairs of strings, and the second step is to perform a series of lookups. The most effective way to store the media types is using an associative array (such as the STL map in C++, or HashMap in Java), however the list is small enough that an array of strings would suffice. Determining the file extension requires first finding the position of the final '.' character (using strrchr or rfind in C++, or lastIndexOf in Java), then discarding the remainder of the string (using substr in C++, or substring in Java).

SETTER'S SOLUTION

Can be found here.

TESTER'S SOLUTION

Can be found here.


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>