@@ -24,7 +24,10 @@ public static <T> void printArray_generic_type(T[] nums) {
24
24
public static void main (String ... strings ) {
25
25
Integer [] nums = new Integer []{1 , 2 , 3 , 4 , 5 };
26
26
printArray_generic_type (nums );
27
- CommonUtils .printListList (convertLeetCode2DStringArrayInputIntoJavaArray ("[\" A\" ,\" B\" ],[\" C\" ],[\" B\" ,\" C\" ],[\" D\" ]" ));
27
+ String input1 = "[\" zDkA\" ,\" GfAj\" ,\" lt\" ],[\" GfAj\" ,\" rtupD\" ,\" og\" ,\" l\" ],[\" rtupD\" ,\" IT\" ,\" jGcew\" ,\" ZwFqF\" ],[\" og\" ,\" yVobt\" ,\" EjA\" ,\" piUyQ\" ],[\" IT\" ,\" XFlc\" ,\" W\" ,\" rB\" ],[\" l\" ,\" GwQg\" ,\" shco\" ,\" Dub\" ,\" KwgZq\" ],[\" oXMG\" ,\" uqe\" ],[\" sNyV\" ,\" WbrP\" ]" ;
28
+ String input2 = "[\" A\" ,\" B\" ],[\" C\" ],[\" B\" ,\" C\" ],[\" D\" ]" ;
29
+ CommonUtils .printListList (convertLeetCode2DStringArrayInputIntoJavaArray (input1 ));
30
+ CommonUtils .printListList (convertLeetCode2DStringArrayInputIntoJavaArray (input2 ));
28
31
CommonUtils .print (convertLeetCode1DStringArrayInputIntoJavaArray ("[\" abcsi\" ,\" abyzjgj\" ,\" advz\" ,\" ag\" ,\" agkgdkob\" ,\" agpr\" ,\" ail\" ]" ));
29
32
CommonUtils .print2DIntArray (convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray ("[448,931,123,345],[889],[214,962],[576,746,897]" ));
30
33
}
@@ -387,6 +390,11 @@ public static int[][] convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray(S
387
390
388
391
public static List <List <String >> convertLeetCode2DStringArrayInputIntoJavaArray (String input ) {
389
392
/**
393
+ * How to copy LeetCode 2-d String array into this method:
394
+ * 1. remove the beginning and ending quotes;
395
+ * 2. put double quotes into this method parameter;
396
+ * 3. copy the input into the double quotes.
397
+ *
390
398
* LeetCode 2-d array input usually comes like this: each row could have different length
391
399
* [["A","B"],["C"],["B","C"],["D"]]
392
400
* The expected input for this method is: "[\"A\",\"B\"],[\"C\"],[\"B\",\"C\"],[\"D\"]"
0 commit comments