
leetcode
文章平均质量分 57
AlwaysCoding
AlwaysCoding
展开
-
leetcode(longest consecutive sequence)
Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest原创 2013-11-03 19:16:56 · 790 阅读 · 0 评论 -
[leetcode]SameTree
Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the原创 2013-12-10 10:52:34 · 863 阅读 · 0 评论 -
[leetcode]twoSum
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 numbers such that they add up to the target, whe原创 2013-12-21 21:24:58 · 825 阅读 · 0 评论 -
Value Palindrome
运用了STL函数。#include#includeusing namespace std;bool isPalindrome1(string text){ text.erase(remove_if(text.begin(), text.end(), [](char c){ //lambda return !isalpha(c) ; }), text.end());原创 2013-12-11 10:14:51 · 783 阅读 · 0 评论 -
[LeetCode]3sum
#include#include#includeusing namespace std;class solution{public:vector > threesum(vector& num){vector > result;if(num.size() sort(num.begin(),num.end());const int target=0;原创 2013-11-03 19:46:24 · 992 阅读 · 0 评论