![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode/LintCode
文章平均质量分 52
richard_飞飞
天空中没有翅膀的痕迹,但我已经飞过
展开
-
Majority Number II
题目描述链接地址解法算法解释题目描述Given an array of integers, the majority number is the number that occurs more than 1/3 of the size of the array.ExampleGiven [1, 2, 1, 2, 1, 3, 3], return 1.Cha原创 2015-07-22 22:17:53 · 1033 阅读 · 0 评论 -
Majority Number
题目描述链接地址解法算法解释题目描述Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it..ExampleGiven [1, 1, 1, 1, 2, 2, 2], return 1ChallengeO(n原创 2015-07-21 00:08:05 · 1300 阅读 · 0 评论 -
Single Number III
题目描述链接地址解法算法解释题目描述Given 2*n + 2 numbers, every numbers occurs twice except two, find them.ExampleGiven [1,2,2,3,4,4,5,3] return 1 and 5ChallengeO(n) time, O(1) extra space. .链接地址http://www.lintcode原创 2015-07-20 22:41:35 · 2998 阅读 · 1 评论 -
Single Number
题目描述链接地址解法算法解释题目描述Given 2*n + 1 numbers, every numbers occurs twice except one, find it. ExampleGiven [1,2,2,1,3,4,3], return 4链接地址http://www.lintcode.com/en/problem/single-number/解法 int singleNu原创 2015-07-19 18:35:17 · 811 阅读 · 0 评论 -
Single Number II
题目描述链接地址解法算法解释题目描述Given 3*n + 1 numbers, every numbers occurs triple times except one, find it.ExampleGiven [1,1,2,3,3,3,2,2,4,1] return 4ChallengeOne-pass, constant extra space.链接地址http://www.lintc原创 2015-07-19 22:42:15 · 914 阅读 · 0 评论 -
Remove Duplicates from Sorted List
题目描述链接地址解法题目描述Given a sorted linked list, delete all duplicates such that each element appear only once.Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.链接地址http://www.lintcode.com/en原创 2015-07-07 23:57:52 · 648 阅读 · 0 评论 -
Partition List
题目描述链接地址解法题目描述Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes原创 2015-07-07 00:22:07 · 1094 阅读 · 0 评论 -
Nth to Last Node in List
题目描述链接地址解法题目描述Find the nth to last element of a singly linked list. The minimum number of nodes in list is n. ExampleGiven a List 3->2->1->5->null and n = 2, return node whose value is 1.链接地址http原创 2015-07-06 21:13:17 · 956 阅读 · 2 评论 -
Reverse Linked List
题目描述链接地址解法1解法2题目描述ExampleFor linked list 1->2->3, the reversed linked list is 3->2->1链接地址http://www.lintcode.com/en/problem/reverse-linked-list/解法1 ListNode *reverse(ListNode *head) { // wri原创 2015-07-05 23:48:24 · 977 阅读 · 0 评论 -
vector容器常用方法
容器简介定义及初始化末尾插入元素遍历 size 函数是可以动态增加的通过下标操作增加改变vector内容不是安全的操作仅能对已存在元素进行下标操作不存在会crash将元素一个容器复制给另外一个容器类型必须匹配容器类型和元素类型必须相同迭代器简介定义begin和end操作迭代器的自增和解引用操作迭代器的算术操作const_iterator 只读容器简介定义及初始化vector<原创 2015-06-24 01:35:11 · 1841 阅读 · 0 评论 -
Balanced Binary Tree
descriptionGiven a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node nev原创 2015-06-25 22:08:28 · 799 阅读 · 0 评论 -
Two Sum
link:https://oj.leetcode.com/problems/two-sum/描述: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原创 2015-02-02 20:52:56 · 859 阅读 · 0 评论 -
Remove Duplicates from Sorted Array
描述Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in原创 2014-07-13 18:11:52 · 794 阅读 · 0 评论 -
Remove Duplicates from Sorted List II
题目描述链接地址解法题目描述Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. ExampleGiven 1->2->3->3->4->4->5, return 1->2->5. Given原创 2015-07-08 22:31:16 · 935 阅读 · 0 评论