[LeetCode]1.Two Sum - Yoona - 博客频道 - CSDN.NET [LeetCode]2.Add Two Numbers - Yoona - 博客频道 - CSDN.NET [LeetCode]3.Longest Substring Without Repeating Characters - Yoona - 博客频道 - CSDN.NET [LeetCode]4....
阅读(2083) 评论(0)

[LeetCode]5.Longest Palindromic Substring

题目Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.思路一即不使用技巧,穷举所有可能。时间复杂度为O(...
阅读(717) 评论(0)

[LeetCode]228.Summary Ranges

题目Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”]....
阅读(1056) 评论(0)

[LeetCode]230.Kth Smallest Element in a BST

题目Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up: What if the BST is m...
阅读(1008) 评论(0)

[LeetCode]231.Power of Two

题目Given an integer, write a function to determine if it is a power of two....
阅读(831) 评论(0)

[LeetCode]240.Search a 2D Matrix II

题目Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right. Integers in each...
阅读(925) 评论(0)

[LeetCode]232.Implement Queue using Stacks

题目Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the front element. empty(...
阅读(992) 评论(0)

[LeetCode]238.Product of Array Except Self

题目Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).For...
阅读(943) 评论(0)

[LeetCode]239.Sliding Window Maximum

题目Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window...
阅读(1310) 评论(0)

[LeetCode]233.Number of Digit One

题目Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example: Given n = 13, Return 6, because digit 1 occurred in the following n...
阅读(1779) 评论(0)

[LeetCode]234.Palindrome Linked List

题目Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?思路利用双指针法找到链表中点位置,链表中点以后的的元素(不包括中点元素)翻转,再跟链表中点位置以前的元素一一匹配。代码/*----------------------...
阅读(1214) 评论(0)

[LeetCode]235.Lowest Common Ancestor of a Binary Search Tree

题目Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between t...
阅读(1216) 评论(0)

[LeetCode]236.Lowest Common Ancestor of a Binary Tree

题目Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes v a...
阅读(1267) 评论(0)

[LeetCode]10.Regular Expression Matching

题目mplement regular expression matching with support for '.' and '*'.'.' Matches any single character. '*' Matches zero or more of the preceding element.The matching should cover the entire input string...
阅读(966) 评论(0)

[LeetCode]91.Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to...
阅读(1532) 评论(0)

[LeetCode]65.Valid Number

Validate if a given string is numeric.Some examples: “0” => true ” 0.1 ” => true “abc” => false “1 a” => false “2e10” => true Note: It is intended for the problem statement to be ambiguous. You...
阅读(1629) 评论(0)

[LeetCode]93.Restore IP Addresses

题目Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given “25525511135”,return [“”, “”]. (Order does no...
阅读(1395) 评论(0)

[LeetCode]*85.Maximal Rectangle

题目Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing all ones and return its area.思路对于上图的一个01矩阵。我们可以一行一行的分析,假设第三行,我们按列扫描,遇到0时,柱子断开,重新形成柱子,遇到1时柱子高度加一。这样的话,我们就可以把问题转换...
阅读(1131) 评论(0)

[LeetCode]*84.Largest Rectangle in Histogram

题目Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each ba...
阅读(1325) 评论(0)

[LeetCode]139.Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given s = “leetcode”, dict = [“leet”, “...
阅读(1460) 评论(0)
163条 共9页1 2 3 4 5 ... 下一页 尾页
    • 访问:1240476次
    • 积分:19944
    • 等级:
    • 排名:第437名
    • 原创:621篇
    • 转载:132篇
    • 译文:50篇
    • 评论:173条