leetcode
文章平均质量分 60
ych19871020
这个作者很懒,什么都没留下…
展开
-
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, whe原创 2015-05-20 21:37:38 · 323 阅读 · 0 评论 -
leetcode Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st原创 2015-05-22 20:47:20 · 361 阅读 · 0 评论 -
leetcode Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin原创 2015-05-22 15:31:01 · 378 阅读 · 0 评论 -
leetcode Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or mo原创 2015-05-22 13:13:45 · 413 阅读 · 0 评论 -
leetcode Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, no原创 2015-05-22 10:08:20 · 400 阅读 · 0 评论 -
leetcode Balanced Binary Tree
Given 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 never diffe原创 2015-05-18 16:27:54 · 338 阅读 · 0 评论 -
leetcode Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2015-05-18 21:41:43 · 340 阅读 · 0 评论 -
leetcode Anagrams
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.这个是找出所有的回购词#include #include #include #include #include #include原创 2015-05-18 14:48:40 · 326 阅读 · 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 link原创 2015-05-18 13:53:06 · 304 阅读 · 0 评论 -
leetcode Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".思路:反转在逐位加,在反#include #include #include #include using std::vector;us原创 2015-05-18 13:01:57 · 291 阅读 · 0 评论 -
leetcode ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I原创 2015-05-22 01:30:27 · 339 阅读 · 0 评论 -
leetcode Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321class Solution {public: int reverse(int x) { bool flag = x < 0 ?0:1; ostri原创 2015-05-22 02:00:21 · 330 阅读 · 0 评论 -
leetcode Add and Search Word - Data structure design
很久没刷题,再次面对trie居然没有第一时间想起来Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regular express原创 2015-05-17 21:14:31 · 369 阅读 · 0 评论 -
leetcode Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo原创 2015-05-21 00:23:10 · 278 阅读 · 0 评论 -
leetcode Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).class Solution {publ原创 2015-05-21 00:53:09 · 330 阅读 · 0 评论 -
leetcode Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on原创 2015-05-19 12:27:25 · 345 阅读 · 0 评论