Guest User

Untitled

a guest
Sep 19th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. Good Morning Johnneylee,
  2.  
  3. You have been selected for a phone interview. Prior to the interview, the hiring manager would like you to complete the following puzzle. Please complete and return to me.
  4.  
  5. =========== BEGIN PUZZLE TEST =============
  6. Z1. "Queue-Tip"
  7. Imagine a queue that looks like the following: ABCDEFGH
  8. A is in slot 0 of the queue, and H is in slot 7. The alphabet gods have now
  9. told you to defy the order of this queue on-demand. Your task is to write a
  10. program that accepts pairs of values, one being a slot number, and the other
  11. being a letter. The program should be able to accept any even combination of
  12. unique slot numbers and letters, which pairs in the order of letters and
  13. numbers received, and should throw an error if an odd number of arguments are
  14. passed or if a slot number and letter are used more than once in the argument
  15. list. Based on the input, the queue will change, and you will output the new
  16. queue. Any letters that are not defined in the arguments passed should move
  17. into the open slots in alphabetical order (much like a queue, ironically). If
  18. no arguments are passed, the original queue should output. It is also safe to
  19. throw an error if a letter that doesn’t exist in the queue is passed, and also
  20. if a slot number is passed that is larger than the size of the queue.
  21. Example input: Myprog 3 A B 5
  22. Expected output: CDEAFBGH
  23. Example input: Myprog A H 1 6 7 E
  24. Expected output: BACDFGHE
  25. Bad inputs: Myprog A 1 A 2 Myprog A 1 B 3 C
  26. Z2. "Sort-sort-sort-it-out"
  27. You're receiving a delimited text file, and it's very large (greater than 1GB).
  28. Some fields contain alpha numeric characters, and fields may be duplicated. You
  29. should process the file and output strings that occur multiple times in the
  30. same field and the number of occurrences. You should also sort as you go,
  31. meaning that the most frequently occurring words are at the top. Consider the
  32. following concerns:
  33. Simple, elegant code. Memory efficiency. Computational run time.
  34. EXAMPLE: 1,2,3,4,5
  35. foo,bar,foodbar,foobar,faboor
  36. fSU_)d89fs-,sjdoknfpoi,doof,foobar,oiufs
  37. &^T(^#(*&$,1233880,FOODBARz,%%YES%%,NV
  38. apoif,bar,pf9,FOOBAR,null
  39. The output would be
  40. bar - column 2 - occurrences: 2
  41. foobar - column 4 - occurrences: 2
  42. foo - column 1 - occurrences: 1
  43. fSU_)d89fs- - column 1 - occurrences: 1
  44. etc...
  45. Z3. "Tran-slay-tor"
  46. You need to write a program that follows a simple interface. This interface has
  47. one method/function/routine that accepts a single argument of a filepath and
  48. returns a filepath to a new file it has written out. The method should be
  49. called translate. It must be able to read an arbitrary set of chained
  50. instructions and perform the translation described on the file. In cases of
  51. ambiguity, simply document your decisions.
  52. Entities your program should understand CHARACTER CONSONANT VOWEL NUMBER WORD LINE
  53. Operators: +-/*><=
  54. Actions you should support: REPLACE WITH REVERSE var PREPEND APPEND
  55. Modifiers: CONSECUTIVE UNIQUE
  56. So a given instruction set might look like:
  57. consecutive vowels replace with 'x' consecutive consonants append 'bar' numbers > 10 reverse line
  58. And they would respective produce outputs:
  59. My name is foobar => My name is fxbar
  60. I am happy to buy all 5 => I am happbary to buy all 5
  61. There are 100s of foos! => !sxf fo s001 era erehT
  62. ============ END PUZZLE TEST ==============
  63.  
  64.  
  65. Thank you,
  66. - Niraj
Add Comment
Please, Sign In to add comment