![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 58
董道不渝
余将董道而不豫兮
展开
-
single-number
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 e原创 2015-07-02 10:41:41 · 342 阅读 · 0 评论 -
leetcode:Container With Most Water
class Solution{public: int maxArea(vector& height) { /*int i, j, mx = 0; for(i = 0; i < height.size(); i++) { for(j = i + 1; j < height.size(); j++)原创 2015-08-04 21:56:02 · 323 阅读 · 0 评论 -
leetcode:Longest Palindromic Substring
class Solution{public: string longestPalindrome(string s) { string sNew, longest; int i, j = 0, iMax = 1, id = 1; int p[2222]; memset(p, 0, sizeof(p));原创 2015-08-02 20:17:22 · 350 阅读 · 0 评论 -
leetcode:Longest Substring Without Repeating Characters
class Solution{public: int lengthOfLongestSubstring(string s) { int i, j, k, len, preLen = 0, maxLen = 0; map m; map :: iterator it; for(i = 0; i < s.size();原创 2015-08-01 19:09:24 · 334 阅读 · 0 评论 -
leetcode:the skyline problem
class Solution{public: struct node { int x, heightIndex; bool leftOrRight; node(int _x, int _heightIndex, bool _leftOrRight):x(_x), heightIndex(_heightIndex), leftOrR原创 2015-07-31 23:21:41 · 406 阅读 · 0 评论 -
leetcode:Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a原创 2015-07-15 21:37:05 · 443 阅读 · 0 评论 -
leetcode:Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.class Solution {public: int trailingZeroes(int n) { int c原创 2015-07-15 22:46:07 · 339 阅读 · 0 评论 -
leetcode: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 the two numbers such that they add up to the target, w原创 2015-07-12 22:45:29 · 436 阅读 · 0 评论 -
maximum-depth-of-binary-tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for binary tre原创 2015-07-02 16:39:20 · 389 阅读 · 0 评论 -
leetcode:Integer to Roman
class Solution{public: string str(int x, int y) { string s; int i; if(x == 0) { if(y > 0 && y < 4) { for(i = 0; i < y;原创 2015-08-05 16:47:47 · 311 阅读 · 0 评论