MCPcopy Create free account
hub / github.com/careercup/ctci / insertInside

Method insertInside

java/Chapter 9/Question9_6/QuestionA.java:7–11  ·  view source on GitHub ↗
(String str, int leftIndex)

Source from the content-addressed store, hash-verified

5
6public class QuestionA {
7 public static String insertInside(String str, int leftIndex) {
8 String left = str.substring(0, leftIndex + 1);
9 String right = str.substring(leftIndex + 1, str.length());
10 return left + "()" + right;
11 }
12
13 public static Set<String> generateParens(int remaining) {
14 Set<String> set = new HashSet<String>();

Callers 1

generateParensMethod · 0.95

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected