
算法
文章平均质量分 64
旧时明月夜
这个作者很懒,什么都没留下…
展开
-
leetcode:451. Sort Characters By Frequency解题报告
451. Sort Characters By Frequency1、原题Given a string, sort it in decreasing order based on the frequency of characters.2、题目意思及思考解析题目意思很简单,就是给你一个字符串,根据其字符出现的频率对其重新排序;频率高的排在前面,相同频率的排序不限。如“t原创 2017-03-04 20:11:55 · 367 阅读 · 0 评论 -
Leetcode58. Length of Last Word
Length of Last Word1、原题Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not原创 2017-06-03 18:11:44 · 310 阅读 · 0 评论 -
Leetcode31. Next Permutation
31. Next Permutation一、原题Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rea原创 2017-05-22 21:16:59 · 182 阅读 · 0 评论 -
Leetcode110. Balanced Binary Tree
110. Balanced Binary Tree1、原题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 t原创 2017-06-06 17:11:39 · 261 阅读 · 0 评论 -
Leetcode141. Linked List Cycle
141. Linked List Cycle1、原题Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?2、题意解析与思路这道题就是让我们判断一个链表中存不存在环的问题。这个问题比较简原创 2017-06-05 19:27:02 · 236 阅读 · 0 评论 -
Leetcode50. Pow(x, n)
50. Pow(x, n)1、原题Implement pow(x, n).Subscribe to see which companies asked this question.2、题意解析这道题的题意很是简单,就是让我们实现pow(x,n)这个函数。一开始,我想到的是最简单的循环累乘,在这里我们会发现这样超时。因此要改变我们的思路。 我后面原创 2017-06-05 14:44:27 · 275 阅读 · 0 评论 -
Leetcode34. Search for a Range
34. Search for a Range一、原题Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be原创 2017-05-27 17:24:54 · 252 阅读 · 0 评论 -
Leetcode20. Valid Parentheses
20. Valid Parentheses1、原题Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct or原创 2017-05-13 16:54:25 · 166 阅读 · 0 评论 -
Leetcode515. Find Largest Value in Each Tree Row
515. Find Largest Value in Each Tree Row1、原题You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \原创 2017-04-21 23:01:23 · 236 阅读 · 0 评论 -
LeetCode137. Single Number II
137. Single Number II1、原题Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.2、题目解析与思路这道题是从Single NumberI发展原创 2017-04-16 02:24:54 · 210 阅读 · 0 评论 -
LeetCode11. Container With Most Water
11. Container With Most Water1、原题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原创 2017-04-30 23:28:38 · 257 阅读 · 0 评论 -
LeetCode538. Convert BST to Greater Tree
Convert BST to Greater Tree1、原题Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greate原创 2017-03-26 14:59:43 · 995 阅读 · 0 评论 -
leetcode15. 3Sum
15. 3Sum1、原题Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.2、解读与思路这道题目的意原创 2017-04-02 10:36:55 · 192 阅读 · 0 评论 -
leetcode:Longest Substring Without Repeating Characters解题报告
Longest Substring Without Repeating Characters1、原题Given a string, find the length of the longest substring without repeating characters.2、题目解析及分析题目一目了然,很简单,让我们一遍找到一个字符串的最小子串。首先,这道题原创 2017-03-12 18:43:49 · 212 阅读 · 0 评论 -
482. License Key Formatting解题报告
482. License Key Formatting1、原题:Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and原创 2017-02-26 19:23:06 · 349 阅读 · 0 评论 -
Leetcode6、ZigZag Conversion
ZigZag Conversion1、原题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 legibili原创 2017-03-18 16:39:06 · 226 阅读 · 0 评论 -
leetcode:136. Single Number解题报告
Single Number1、原题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 imple原创 2017-03-04 21:08:33 · 372 阅读 · 0 评论 -
Leetcode59. Spiral Matrix II
59. Spiral Matrix II1、原题Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:原创 2017-06-03 18:48:07 · 254 阅读 · 0 评论