上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页
摘要: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2016-10-08 15:23 Machelsky 阅读(105) 评论(0) 推荐(0)
摘要: Sort a linked list using insertion sort. 思路:插入排序,就是把node插入到左边的链表中。用一个dummynode来构造左边的链表。要是比最左边的数还小,就插到最左边也就是dummy.next。如果不是,则linear search左边的链表插入。 阅读全文
posted @ 2016-10-08 15:13 Machelsky 阅读(113) 评论(0) 推荐(0)
摘要: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文
posted @ 2016-10-08 14:39 Machelsky 阅读(117) 评论(0) 推荐(0)
摘要: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2016-10-08 14:26 Machelsky 阅读(172) 评论(0) 推荐(0)
摘要: Implement int sqrt(int x). 二分法,找中值。注意不能用low<high来判断。举例:sqrt(5),low<high的话一直在2的右边搜索,最后low=3 high=3是不正确的,要再进入循环去得到最后的结果。 阅读全文
posted @ 2016-10-08 14:04 Machelsky 阅读(123) 评论(0) 推荐(0)
摘要: Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Your algorithm 阅读全文
posted @ 2016-10-04 16:26 Machelsky 阅读(94) 评论(0) 推荐(0)
摘要: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文
posted @ 2016-10-04 16:00 Machelsky 阅读(122) 评论(0) 推荐(0)
摘要: Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0. 阅读全文
posted @ 2016-09-28 15:25 Machelsky 阅读(121) 评论(0) 推荐(0)
摘要: Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all mee 阅读全文
posted @ 2016-09-28 14:59 Machelsky 阅读(161) 评论(0) 推荐(0)
摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2016-09-28 03:44 Machelsky 阅读(83) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页