Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.84 KB | None | 0 0
  1. You are a Network Admin for your company and your day-to-day activity includes interacting with IP addresses and network subnets. Today, you will focus only on the IPv4 protocol. You have a situation for which you need to determine if a given IP address belongs to a subnet. To do so, you must compare the candidate IP address with the range of the subnet. Consider an example subnet that begins at 10.0.0.1 and ends at 11.199.88.254. For this subnet, 10.43.59.96 is within range, while 111.19.12.154 is outside of the range. Note that your input may also contain invalid IP addresses such as 12500.58.18. Any IP address that is incorrectly formatted, is less than 0.0.0.0, or is greater than 255.255.255.255 is an invalid IP address.
  2.  
  3. In summary, your task is to determine whether an IP address is within range, out side of range, or invalid.
  4.  
  5. Input description/format
  6.  
  7. Each line of the input will contain 3 IP Addresses, separated by spaces:
  8.  
  9. The first IP address represents the first valid IP address of the subnet.
  10. The second IP address represents the
  11. last valid IP address of the subnet.
  12. The 3rd IP address is the address to validate.
  13. Output description/format
  14.  
  15. For each line of input, output the result in one of the following 3 ways (case sensitive):
  16.  
  17. InRange
  18. InValid
  19. OutRange
  20. Example input
  21.  
  22. 10.0.0.1 11.199.88.254 1000.43.59.96
  23. 10.0.0.1 11.199.88.254 10.43.59.96
  24. 10.0.0.1 11.199.88.254 111.19.12.154
  25. Example output
  26.  
  27. InValid
  28. InRange
  29. OutRange
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. A Palindrome phrase is a string starting at the beginning of a word and ending at the end of a word that contains the same alphanumeric characters both from left to right and right to left. Given lines of text, find the largest palindrome phrase in each line.
  59.  
  60. Clarifications
  61.  
  62. An alphanumeric character is a character that is a number or a letter (punctuation and white space do not count).
  63. For comparing letters, case should be ignored (for example, “Race Car” would be considered a palindrome phrase).
  64. The beginning of a word is an alphanumeric character that is:
  65. preceded by a non-alphanumeric character, or
  66. is the first character in the line.
  67. The end of a word is an alphanumeric character that is:
  68. followed by a non-alphanumeric character, or
  69. is the last character in the line.
  70. The length of the palindrome phrase is measured by the count of the alphanumeric characters it contains (the ignored punctuation, whitespace, etc. do not count toward its length).
  71. Input description/format
  72.  
  73. Multiple lines of text, each potentially containing a palindrome phrase.
  74.  
  75. Output description/format
  76.  
  77. One line for each line of input. Each line should be the substring that is the longest palindrome phrase found in the source line (this should be in the original casing and include any ignored characters). If no palindrome phrase is found, leave a blank line.
  78.  
  79. Example input
  80.  
  81. Dee saw a seed.
  82. Unicode has some weird stuff in it. Do not, bob to ☃ nod.
  83. Example output
  84.  
  85. Dee saw a seed
  86. Do not, bob to ☃ nod
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. The Windows search charm has to provide quick responses to users’ searches for words in their documents. In order to do this it matches the text entered in the search box to every text token on the machine. If the entered text completely matches a token on the machine or even just a the prefix of a token on the machine, it is returned as a result.
  132.  
  133. Users will input text that they are expecting to find in the document they are searching for. Your job is to find that text and return it back to them. Write a program that is able to provide the user with basic information about whether or not their search term appears in a document and how many times it appears.
  134.  
  135. Technical details
  136.  
  137. A token is a complete word with a space or punctuation at either end. The full specification for breaking text into tokens can be found here.
  138. Input Text Tokens
  139. This “isn’t” an e-mail.
  140. This
  141.  
  142. isn
  143.  
  144. t
  145.  
  146. an
  147.  
  148. e
  149.  
  150. mail
  151.  
  152. User search inputs will be a single text token that doesn’t contain punctuation or spaces.
  153. Matching is not case sensitive (Users don’t know the difference between John and john).
  154. Input description/format
  155.  
  156. The input will be a single token, followed by a newline. After that, the document that you are to search will start.
  157.  
  158. Output description/format
  159.  
  160. Your output should take the format: AnswerToA;AnswerToB;AnswerToC, where a-c are defined below.
  161.  
  162. Find the number of times the complete token appears in that document.
  163. Find the total number of tokens that have the token from part A as a prefix.
  164. The complete token from the first match found for part B.
  165. Example input
  166.  
  167. myth
  168.  
  169. Greek mythology is the body of myths and teachings that belong to the ancient Greeks, concerning their gods and heroes, the nature of the world, and the origins and significance of their own cult and ritual practices. It was a part of the religion in ancient Greece. Modern scholars refer to and study the myths in an attempt to throw light on the religious and political institutions of Ancient Greece and its civilization, and to gain understanding of the nature of myth itself.
  170. Example output
  171.  
  172. 1;4;mythology
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. To use the words of the late Mitch Hedberg: “an escalator can never break, it can only become stairs.”
  223.  
  224. You are at the 0th floor of a poorly designed building and need to get to a given floor for an interview. You need to find the path that will allow you to get to your interview in the least amount of time possible. You have in your possession a list of all escalators in this building and the direction in which they are running. At any given time, you can choose to stop any escalator, turn it into stairs, and walk up or down these stairs freely.
  225. Using an escalator has a fixed cost in terms of time. The cost of walking up stairs is equal to the number of stories you are walking up multiplied by your walking speed (S * abs(start_floor – end_floor)).
  226.  
  227. Clarifications
  228.  
  229. You can assume that the building contains an infinite number of floors.
  230. If two paths took the same time, we prefer the path that uses the fewest escalators.
  231. If two escalators were equivalent, we prefer the escalator that has the smallest ID.
  232. If stopping or not stopping an escalator would result in the exact same time consumption, we prefer not stopping it.
  233. Input description/format
  234.  
  235. One line containing the following values (all integers separated by a single white space):
  236.  
  237. T: The floor at which your interview is taking place (your target floor) (> 0)
  238. E: The time it takes to take one escalator (≥ 0)
  239. S: The speed at which you can walk up/down stairs (≥ 0)
  240. N: The number of escalators in the building (≥ 0)
  241. Followed by n lines of the following format, describing the directed escalators of the building (meaning you can only move from the start floor to the end floor and not vice versa, unless you stop the escalator) (all integers ≥ 0, all separated by a single white space):
  242.  
  243. The ID of the escalator (a sequential number that goes from 0 to N-1)
  244. The starting floor of the escalator
  245. The end floor of the escalator (different from the starting floor)
  246. Output description/format
  247.  
  248. If there is no path to get to your interview, output the string Invalid.
  249.  
  250. If there is a solution, print the following three lines:
  251.  
  252. The string STOPPED: followed by a space and (white space separated) escalator IDs that are meant to be stopped (sorted from smallest to largest), or “None” if no escalator was stopped.
  253. The string TIME: followed by a space and the time it will take you to get to the interview.
  254. The string PATH: followed by (white space separated) escalator ID’s in the order that they are visited.
  255. Example input
  256.  
  257. 55 5 1 5
  258. 0 0 5
  259. 1 5 56
  260. 2 5 56
  261. 3 57 55
  262. 4 56 57
  263. Example output
  264.  
  265. STOPPED: 3 4
  266. TIME: 13
  267. PATH: 0 1 4 3
  268. © 2014 MicrosoftContact usOfficial rulesPrivacy and cookiesTerms of useTrademarks
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321. You are faced with a stepping puzzle. You know the word needed to get from one side to the other safely, but you need to find the path.
  322.  
  323. Using a given word and 2D grid of letters, find a path from the top left to the bottom right of the grid. This path must only use adjacent spaces (no diagonals) and it can't use the same space twice. After you have found the path, change all other letters in the grid to periods (.) to let the rest of your friends cross safely.
  324.  
  325. Input description/format
  326.  
  327. The input will be the word to follow followed by a grid of characters.
  328.  
  329. Output description/format
  330.  
  331. The output will be the grid of characters with only the correct path remaining, each other letter in the grid will be replaced with a period (.)
  332.  
  333. Example input
  334.  
  335. SNICKERDOODLE
  336. SNICKE
  337. NRCRDO
  338. IEKODS
  339. CRDOLE
  340. Example output
  341.  
  342. SNI...
  343. ..C...
  344. .EKOD.
  345. .RDOLE
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395. Overview
  396.  
  397. In computer science, trees are a very interesting data structure with many different algorithmic applications. This problem focuses specifically on Binary Trees.
  398.  
  399. A binary tree is a tree structure in which each node has at most two child nodes (often referred to as a left and right).[1]
  400.  
  401. There are several different ways to traverse an existing tree, but in this problem we involve 3 specific traversals.
  402.  
  403. In-order
  404. Post-order
  405. Breadth-first
  406. In this problem, you will be provided a binary tree as input. The tree will be represented by in-order and post-order traversals.
  407.  
  408. The task is to build up a binary tree solely from the given traversals and output a breadth-first traversal.
  409.  
  410. The input tree can be invalid, meaning that it does not represent a binary tree.
  411. You have to make sure to handle invalid input and output InvalidInput if you determine the input to be invalid.
  412. An example of invalid input could be something like this 1-2-3-4-5-6 or this is not a valid binary tree input.
  413.  
  414. See the input and output for more examples of valid and invalid inputs.
  415.  
  416. Clarifications
  417.  
  418. Tree node values are unique, so don’t worry about ambiguity caused by duplicate values
  419. If the tree or input is invalid, the result should be the string InvalidInput
  420. The input trees are not balanced
  421. The input trees have no node value rules
  422. These are binary trees, so remember, at most two children per node
  423. Input description/format
  424.  
  425. A string consisting of two lines.
  426. Each line is a comma separated list of numbers, representing the in-order and post-order traversals.
  427. The numbers themselves are the node values.
  428.  
  429. Output description/format
  430.  
  431. A string representing the breadth-first-order traversal of the tree, where node values are comma separated to represent the tree nodes.
  432.  
  433. Example input
  434.  
  435. 4,2,7,5,8,1,3,9,6,11,10
  436. 4,7,8,5,2,9,11,10,6,3,1
  437. Example output
  438.  
  439. 1,2,3,4,5,6,7,8,9,10,11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement