leetcode
文章平均质量分 54
fan379717894
这个作者很懒,什么都没留下…
展开
-
3sumclosest leetcode
类似于3sum,每组数多了一个比较判断的过程。这段代码中少了去重复的一步public class Solution {public void sort(int[] nums) {int temp; for (int i = 1; i { temp = nums[i]; int j; for (j原创 2015-07-13 22:53:30 · 207 阅读 · 0 评论 -
SetMatrixZeroes
package k;import java.util.ArrayList;import java.util.List;public class SetMatrixZeroes { public void setZeroes(int[][] matrix) { int x=matrix.length; int y=matrix[0].原创 2015-07-14 16:26:13 · 102 阅读 · 0 评论 -
insertion sort list
public class Insert2 {/*** @param args*/public static ListNode insertionSortList(ListNode head) {// q是外层循环,p是内层循环if(head==null||head.next==null){return head;}ListNode before = ne原创 2015-07-16 15:16:21 · 178 阅读 · 0 评论 -
reorder list
public class Solution { public ListNode reorderList(ListNode head) { if(head==null||head.next==null){return head;}ListNode p = head;ListNode q = head;while(p.next!=null){原创 2015-07-20 21:02:22 · 107 阅读 · 0 评论 -
Linked List Cycle&2
package k;public class LinkedListCycle {/*** @param args*/public static boolean hasCycle(ListNode head) { boolean hasCycle=false; if(head==null||head.next==null){retur原创 2015-07-22 17:28:26 · 113 阅读 · 0 评论 -
Pascal trangle leetcode
生成Pascal triangle package k;import java.util.ArrayList;import java.util.List;public class PascalTriangle { /** * @param args */ public List> generate(int numRows) { List> re原创 2015-10-08 15:01:31 · 247 阅读 · 0 评论