上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 28 下一页
摘要: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ext... 阅读全文
posted @ 2017-07-31 19:52 apanda009 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 三步反转法 阅读全文
posted @ 2017-07-31 15:43 apanda009 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 二有序数组常用二分法, 要判断数组是否越界, 而数组的题常用递归, 擦半的方法, 比快排的方法, 少一个partition 遍历, 但是还是分成logn 层, Lintcode: Nuts & Bolts Problem 关键在于找到合适的比较位置, 准备擦出哪个数组的一半, 防止数组越界 The 阅读全文
posted @ 2017-07-31 14:05 apanda009 阅读(140) 评论(0) 推荐(0) 编辑
摘要: sorted 数组, 常用二指针遍历, 会倒叙, 会前序 逆序遍历的好处, 1只遍历后面的 2此题在于空间上可以不干扰. 阅读全文
posted @ 2017-07-31 12:07 apanda009 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 有序数组的题, 二分法, 根据mid的位置再确定start 和end的位置, 画图分情况 三种情况 The idea is that when rotating the array, there must be one half of the array that is still in sorte 阅读全文
posted @ 2017-07-31 11:35 apanda009 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume NO duplicates in the array. ... 阅读全文
posted @ 2017-07-31 10:54 apanda009 阅读(112) 评论(0) 推荐(0) 编辑
摘要: while-loop 要非递归写很简单,就用循环, 如果很复杂,就要用递归. but while 容易死循环 看不出就画图 二分法的模板- 阅读全文
posted @ 2017-07-31 10:44 apanda009 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 两个数组两个指针 两个数组的题常sort, 再通过两指针遍历 常常与0 的差的正负来判断, 来判断指针的走位, 此处直接判断大小更方便 阅读全文
posted @ 2017-07-31 09:49 apanda009 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 其实是一种特别顺序的排序, 所以就用quicksort-partition, 不过比较的元素和设计互相patition, partition 的比较因为是有equals的, 所以得用三个指针遍历 考点: partition 的设计, pivot 的选择 , 另一方的排序通过nuts排好后的数组再排, 阅读全文
posted @ 2017-07-29 19:10 apanda009 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 数组常sort 阅读全文
posted @ 2017-07-29 15:57 apanda009 阅读(125) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 28 下一页