startHi
Problem:
Test Cases:
startHi("hi there") → true
startHi("hi") → true
startHi("hello hi") → false
Solution:
public boolean startHi(String str) {
if(str.startsWith("hi"))
{
return true;
}
return false;
}
Problem:
Given a string, return true if the string starts with "hi" and false otherwise.
Test Cases:
startHi("hi there") → true
startHi("hi") → true
startHi("hello hi") → false
Solution:
public boolean startHi(String str) {
if(str.startsWith("hi"))
{
return true;
}
return false;
}
No comments:
Post a Comment