about | help | code help+videos | done | prefs |
public boolean almostEndsFUL(String str)
public boolean almostEndsFUL(String str) { boolean ends = false; int len = str.length(); if (str.startsWith("ful",len-3)) { ends = true; } return ends; }Change "len-3" to "len-4" ! This will direct startsWith() to begin checking, not at the 3rd-to-last letter, but beginning at the 4th-to-last letter from the end. public boolean almostEndsFUL(String str) { boolean ends = false; int len = str.length(); if (str.startsWith("ful",len-4)) { ends = true; } return ends; } almostEndsFUL("mindful") → false almostEndsFUL("mindfulZ") → true almostEndsFUL("handful") → false ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 1
Copyright Nick Parlante 2017 - privacy