Guest User

Untitled

a guest
Jun 25th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. * Questions
  2. ** Fizz Buzz
  3.  
  4. Write a program that outputs the string representation of numbers from 1 to n.
  5.  
  6. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”.
  7. *** example
  8. #+BEGIN_SRC
  9.  
  10. n = 15,
  11.  
  12. Return:
  13. [
  14. "1",
  15. "2",
  16. "Fizz",
  17. "4",
  18. "Buzz",
  19. "Fizz",
  20. "7",
  21. "8",
  22. "Fizz",
  23. "Buzz",
  24. "11",
  25. "Fizz",
  26. "13",
  27. "14",
  28. "FizzBuzz"
  29. ]
  30. #+END_SRC
  31.  
  32. ** Jewels and Stones
  33.  
  34. You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels.
  35. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A".
  36.  
  37. *** example 1
  38. #+BEGIN_SRC
  39. Input: J = "aA", S = "aAAbbbb"
  40. Output: 3
  41. #+END_SRC
  42.  
  43. *** example 2
  44. #+BEGIN_SRC
  45. Input: J = "z", S = "ZZ"
  46. Output: 0
  47. #+END_SRC
  48.  
  49. *** Note
  50. - S and J will consist of letters and have length at most 50.
  51. - The characters in J are distinct.
  52.  
  53. ** Judge Route Circle
  54. Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.
  55. The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are R (Right), L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle.
  56. *** example 1
  57. #+BEGIN_SRC
  58. Input: "UD"
  59. Output: true
  60. #+END_SRC
  61.  
  62. *** example 2
  63. #+BEGIN_SRC
  64. Input: "LL"
  65. Output: false
  66. #+END_SRC
Add Comment
Please, Sign In to add comment