摘要: Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL. 1 public static LinkedListNode RotateList(LinkedListNode head, int k) 2 { 3 if (head == null) 4 retu... 阅读全文
posted @ 2012-10-15 23:17 ETCOW 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order does not matter) 1 public static List<string> ResotreIPAddress(string s) 2 阅读全文
posted @ 2012-10-15 23:07 ETCOW 阅读(263) 评论(0) 推荐(0) 编辑
摘要: You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place? 1 public static void RotateImage(List<List<int>> matrix) 2 { 3 if (matrix.Count <= 1) 4 return; 5 6 int n =... 阅读全文
posted @ 2012-10-15 22:13 ETCOW 阅读(237) 评论(0) 推荐(0) 编辑