随笔分类 -  leetcode算法积累

https://leetcode.com
摘要:public class BinarySearch { //递归 public static int findData(int[] a, int b, int beginIndex, int endIndex) { if(a.length == 0 || a == null) { return 0; 阅读全文
posted @ 2016-02-29 19:13 笨狗毒毒毒 阅读(196) 评论(0) 推荐(0)
摘要:public class FindNum { public static boolean findANum(int[][] array, int target) { int row = array.length;//行数 int cloumn = array[0].length;//列数 int i 阅读全文
posted @ 2016-02-29 19:09 笨狗毒毒毒 阅读(860) 评论(0) 推荐(0)
摘要:public class StringReplace { public static void replaceSpace(String[] str, int length) { if(str == null || length <= 0) { return; } int originalLength 阅读全文
posted @ 2016-02-29 19:07 笨狗毒毒毒 阅读(258) 评论(0) 推荐(0)
摘要:public class QuickSort { public static int getMidIndex(int[] list, int low, int high) { int temp = list[low]; while(low < high) { while(low<high && li 阅读全文
posted @ 2016-02-29 19:07 笨狗毒毒毒 阅读(144) 评论(0) 推荐(0)
摘要:public class StackByQueue { private LinkedList<String> queue1; private LinkedList<String> queue2; public StackByQueue() { queue1 = new LinkedList<Stri 阅读全文
posted @ 2016-02-29 19:06 笨狗毒毒毒 阅读(176) 评论(0) 推荐(0)
摘要:public class QueueByStack { private Stack<Integer> stack1; private Stack<Integer> stack2; public QueueByStack() { // TODO Auto-generated constructor s 阅读全文
posted @ 2016-02-29 19:05 笨狗毒毒毒 阅读(138) 评论(0) 推荐(0)
摘要:public class MinNumberInRotatedArray { public int getMinNumInRotatedArray(int[] array) { if(array == null) { return -1; } int leftIndex = 0; int right 阅读全文
posted @ 2016-02-29 19:04 笨狗毒毒毒 阅读(369) 评论(0) 推荐(0)
摘要:1 public class test1 { 2 /** 3 * 思路:如果A与某人有共同好友,则该人必出现在二度好友中 4 * 不在二度好友中的,则与A的共同好友数必然为0 5 * 故只需遍历所有的二度好友即可,但是不要将那些无共同好友的一度... 阅读全文
posted @ 2015-11-11 21:39 笨狗毒毒毒 阅读(4129) 评论(0) 推荐(0)
摘要:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2015-11-10 10:27 笨狗毒毒毒 阅读(227) 评论(0) 推荐(0)
摘要:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2015-11-05 17:45 笨狗毒毒毒 阅读(233) 评论(0) 推荐(0)