Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Questions
- ** Fizz Buzz
- Write a program that outputs the string representation of numbers from 1 to n.
- 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”.
- *** example
- #+BEGIN_SRC
- n = 15,
- Return:
- [
- "1",
- "2",
- "Fizz",
- "4",
- "Buzz",
- "Fizz",
- "7",
- "8",
- "Fizz",
- "Buzz",
- "11",
- "Fizz",
- "13",
- "14",
- "FizzBuzz"
- ]
- #+END_SRC
- ** Jewels and Stones
- 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.
- 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".
- *** example 1
- #+BEGIN_SRC
- Input: J = "aA", S = "aAAbbbb"
- Output: 3
- #+END_SRC
- *** example 2
- #+BEGIN_SRC
- Input: J = "z", S = "ZZ"
- Output: 0
- #+END_SRC
- *** Note
- - S and J will consist of letters and have length at most 50.
- - The characters in J are distinct.
- ** Judge Route Circle
- 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.
- 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.
- *** example 1
- #+BEGIN_SRC
- Input: "UD"
- Output: true
- #+END_SRC
- *** example 2
- #+BEGIN_SRC
- Input: "LL"
- Output: false
- #+END_SRC
Add Comment
Please, Sign In to add comment