← All topics
Strings Quiz: questions with answers
8 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Why is s = s + ch inside a loop slow in Java and Python?
- Q2. In Java, how should you compare the contents of two strings a and b?
- Q3. What does this print? (code)
- Q4. What does this print? (code)
- Q5. How many centers does "expand around center" check for a string of length n?
- Q6. What is the longest palindromic substring of "babad"? (either correct answer is accepted)
- Q7. Which techniques are commonly used for string problems? (select all that apply)
- Q8. What is the longest common prefix of ["flower", "flow", "flight"]?