2020-01-01から1ヶ月間の記事一覧

int[]または文字列からListNodeを作成するクラス

文字列でもint[]でも構築可能 public class ListNode { public int val; public ListNode next; public ListNode(int x) { val = x; } } class ListNodeHelper { public static ListNode CreateListNode(string nums) { if (nums == null) return null; stri…

int[]またはstring[]からTreeNodeを作成するクラス

nullが必要ならstring null不要ならint public class TreeNode { public int val; public TreeNode left; public TreeNode right; public TreeNode(int x) { val = x; } } class TreeNodeHelper { public static TreeNode CreateTree(int[] nums) { return C…

'a'と'A'の相互変換

aのAsciiコードは10進で65 AのAsciiコードは10進で97 char 10進 2進 a 65 1000001 A 97 1100001| z 90 1011010 Z 122 1111010 'a' xor 'A'~'z' xor 'Z'`をやってみればよい。 char[] wk1 = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',…