摘要: public static string LongestPalindrome(string s) { string T = preProcess(s); int n = T.Length; int[] P = new int[n]; //C是中心位置下标,R是长度 ... 阅读全文
posted @ 2016-11-06 23:15 pzhang22 阅读(165) 评论(0) 推荐(0) 编辑
摘要: public static int[] TwoSum(int[] nums, int target) { int[] result = new int[2]; //key为数值,value为它的索引值 Dictionary temp = new Dictionary(); ... 阅读全文
posted @ 2016-10-31 23:41 pzhang22 阅读(141) 评论(0) 推荐(0) 编辑
摘要: public int MyAtoi(string str) { if (string.IsNullOrEmpty(str)) { return 0; } int sign = 1; int i = 0; ... 阅读全文
posted @ 2016-10-31 23:13 pzhang22 阅读(117) 评论(0) 推荐(0) 编辑
摘要: public int Reverse(int input) { long reversedNum = 0; while (input != 0) { reversedNum = reversedNum * 10 + input % 10; ... 阅读全文
posted @ 2016-10-31 23:11 pzhang22 阅读(60) 评论(0) 推荐(0) 编辑
摘要: public string Convert(string s, int numRows) { if (numRows <= 1 || s.Length == 0) { return s; } string res = ""; ... 阅读全文
posted @ 2016-10-31 23:09 pzhang22 阅读(94) 评论(0) 推荐(0) 编辑
摘要: public double FindMedianSortedArrays(int[] nums1, int[] nums2) { int m = nums1.Length; int n = nums2.Length; int total = m + n; if (tot... 阅读全文
posted @ 2016-10-31 23:08 pzhang22 阅读(123) 评论(0) 推荐(0) 编辑
摘要: public int LengthOfLongestSubstring(string s) { int[] mOccur = new int[256]; int maxL = 0; char[] schar = s.ToCharArray(); for (int i = 0, j = 0; i 1) ... 阅读全文
posted @ 2016-10-31 23:04 pzhang22 阅读(58) 评论(0) 推荐(0) 编辑
摘要: public class ListNode { public int val; public ListNode next; public ListNode(int x) { val = x; } } public class Solution { public ListNode AddT... 阅读全文
posted @ 2016-10-31 22:59 pzhang22 阅读(83) 评论(0) 推荐(0) 编辑
摘要: public class Node { public object Element; public Node Link; public Node() { Element = null; Link = null; } public Node(object theElement) { Element = theElement; Link = null; } }public class Li... 阅读全文
posted @ 2013-03-20 15:09 pzhang22 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 链表定义:public class Node { public object Element; //指向下一个节点的链接 public Node FLink; //指向上一个节点的链接 public Node BLink; public Node() { Element = null; FLink = null; BLink = null; } public Node(object theEleme... 阅读全文
posted @ 2013-03-20 13:50 pzhang22 阅读(150) 评论(0) 推荐(0) 编辑