Nice solution! A nitpick:result.append("<b>" + s.substring(i, j) + "</b>");
Why not take advantage of StringBuilder since we're already using it? So change it to:result.append("<b>").append(s.substring(start, end)).append("</b>");
Add Bold Tag in String
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.