Microsoft Coding Competition - University of Missouri II

Wu Rui bio photo By Wu Rui Comment

Here posts  3 problems without solution.

Question Two OData service | 2 point(s)

The Open Data Protocol (OData) is a data access protocol created by Microsoft that builds on simple REST principles. Your task is to retrieve certain data from a sample (live) OData service. For this problem you will be working with the OData service located here. You will retrieve data from an entity set called ‘Products’. An entity set is equivalent to a table in a relational database. The Products entity set is located here.

Your input file will consist of a series of simple queries to perform on the Products entity set. The input will contain a $filter expression to perform on Products. This is equivalent to a WHERE clause in SQL. Your job is simply to see how many entities (rows in a table) are returned from the specified query.

Normally a request to the endpoint specified above would return product data - but since you are only interested in the number of entities that would be returned, you can send requests to this special $count endpoint. After sending an appropriate request to this endpoint, it will respond with the number of entities that match the query. Print out this value on a line in the output file. Your output file will have one line per line of input containing one number.

Input description/format The input will be a series of $filter queries to perform. Each line of input will correspond to a single query. For instance, the input line: Discontinued eq true should send a GET request to the following URL:$count?$filter=Discontinued eq true

Output description/format Your output will be a single number per line of input, indicating how many entities match the given query.

Example input

Discontinued eq true

SupplierID eq 4

CategoryID eq 2

Example output




Question Three Unicode email addresses | 2 point(s)

With the expansion of the Internet across the world, the demand is growing for everyone to have an email address. Until everyone is ready to use international characters, you are now in charge of writing a converter that will take UTF-8 characters and bring them back to something DNS servers will be able to handle. To do so, you must take an email string and break it into 3 pieces: first@second.third. Process each piece as follows: Leave all characters that have ASCII codes between 33 and 126 as is, except convert uppercase letters to lowercase letters Represent all other characters (referred to hereinafter as special characters) using the format +position?UTF-8_hexadecimal_representation The position is the 0-indexed position of the represented character The UTF-8 hexadecimal representation must not contain spaces and must be finalized If at least one special character was present in the string, append a ~ and each special character at the end of the address.

For example, the piece Pøpø would be processed to pp+1?C3B8+3?C3B8~øø Clarifications There shouldn’t be any spaces. You will receive only characters contained within the UTF-8 standard

Input description/format

Each line will be an email address with Unicode characters.

Output description/format

new email address composition characters removed in order

Example input





comments powered by Disqus