- 博客(5)
- 资源 (1)
- 收藏
- 关注
原创 【leetcode 148 Sort List】
Sort a linked list in O(n log n) time using constant space complexity. 既然要求复杂度为O(nlogn),那么要么是快速排序要么是归并排序,这里采用归并排序,需要注意mid分割点的寻找 采用快慢指针得到mid节点,然后分为两段进行排序并合并,递归进行。代码如下: public ListNode sortList(Li
2015-05-26 14:11:40
263
原创 【leetcode 190 Reverse Bits 】
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as0011100101
2015-05-18 11:13:33
286
原创 【leetcode 203 Remove Linked List Elements 】
Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 --> 5 删除链表中的指定元素,该元素可能有多个,需要注意
2015-05-18 10:16:59
256
原创 [leetcode] Search in Rotated Sorted Array
基于折半查找,主要思想就是: 1、先找到mid元素,相等返回mid; 2、找到有序部分; 3、根据target是否在有序部分,进行循环划分; 主要代码: public class Solution { public int search(int[] nums, int target) { int low = 0; int
2015-05-13 15:48:14
294
原创 2015-04-03myeclipse常见问题总结
1、myeclipse 中文乱码问题: a)设置整个myeclipse环境为UTF-8:window->Preferences->general->Workspace->Text file encoding->Other框中的Text file encoding改为UTF-8。 b)单改某一个项目编码:项目名上右键->Properties->Resource->Text file encodi
2015-04-03 14:20:36
319
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人