Complete the following method, prefix(String s1, String s2), which returns true if s7 is a prefix of $2, s2 is a prefix of s1, or they are equal. Sample runs Input 1: start starp Output 1: false Input 2: espn espn Output 2: true

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question
Complete the following method, prefix(String s1, String s2), which returns true if s7 is a prefix of s2, s2 is a prefix of
s1, or they are equal.
Sample runs
Input 1:
start
starp
Output 1:
false
Input 2:
espn
espn+
Output 2:
true
Transcribed Image Text:Complete the following method, prefix(String s1, String s2), which returns true if s7 is a prefix of s2, s2 is a prefix of s1, or they are equal. Sample runs Input 1: start starp Output 1: false Input 2: espn espn+ Output 2: true
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT