Here are two problems value 1 point each. Most team can get these 2 points and I spent 30 minutes on each one.
Question Five A variation on anagrams | 1 point(s)
Let’s assume you were recently hired by a Start-up. On the first day, you meet the CEO and are given an assignment. Your CEO has decided that all products will be named according to the following pattern.
Your CEO calls the pattern “P@tter”. Two product names obey P@tter if they are permutations of each other, ignoring spaces and capitalization. Your task is to determine whether two product names obey P@tter.
Input description/format The input will consist of two product names per line, in quotation marks, which are not part of the names. The quoted names will be separated by a comma and potentially whitespace. You can assume that there will be ≤ 1000 lines in the input file. Also, product name length will be ≤ 255 characters and product names will contain only ASCII characters.
Output description/format For each line of input, output the result in one of the following 2 ways (case sensitive): Valid Pattern Invalid Pattern
“Calculate”, “Acute Call”
“Drop Cue” , “Cued Pro”
“carE Not”, “raCe On”
This is kind of straight forward. First you decompose each input and then tell if they are anagrams or not.
Question Six Detecting unreachable instructions | 1 point(s)
Untouched instructions in code can cause some serious problems. You may have heard about a recent security hole related to this topic. Your task is to write a small program that catches the “untouched” lines of code written in our simplified programming language. The program starts at line 1. You may assume the program will be terminated if it infinitely loops or continues past its last instruction.
Input description/format Each line of input contains an instruction (NEXT or GOTO). NEXT: the program will move to the next line. GOTO X: the program will go to line number X.
Output description/format Please print out the line number of instructions that the program doesn’t touch (one line number per line in the output file).
This instructions structure is like a linked list. First store all instructions with its line number in a set. Execute instructions and remove executed one from the set. if there’s no next instruction or next instruction is already removed from the set( means loop happens), stop execution.comments powered by Disqus