- 博客(125)
- 收藏
- 关注
原创 LeetCode 345. Reverse Vowels of a String(翻转元音字母)
原题网址:https://leetcode.com/problems/reverse-vowels-of-a-string/Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "hol
2016-04-30 12:16:13 822
原创 LeetCode 344. Reverse String(字符串翻转)
原题网址:https://leetcode.com/problems/reverse-string/Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".方法:循环。public c
2016-04-30 12:04:53 826
原创 LeetCode 343. Integer Break(整数分拆)
原题网址:https://leetcode.com/problems/integer-break/Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximu
2016-04-30 12:00:37 1192
原创 LeetCode 342. Power of Four(4的n次幂)
原题网址:342. Power of Four 342. Power of Four 342. Power of Four 342. Power of FourGiven an integer (signed 32 bits), write a function to check whether it is a power of 4.Example:Given num =
2016-04-30 11:08:01 457
原创 LeetCode 341. Flatten Nested List Iterator(嵌套列表迭代器)
原题网址:https://leetcode.com/problems/flatten-nested-list-iterator/Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list -- whose ele
2016-04-30 10:15:08 1404
原创 LeetCode 340. Longest Substring with At Most K Distinct Characters(最长字串)
原题网址:https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/Given a string, find the length of the longest substring T that contains at most k distinct characters.
2016-04-30 09:10:31 1300
原创 LeetCode 339. Nested List Weight Sum(加权和)
原题网址:https://leetcode.com/problems/nested-list-weight-sum/Given a nested list of integers, return the sum of all integers in the list weighted by their depth.Each element is either an intege
2016-04-30 08:44:55 1863
原创 LeetCode 338. Counting Bits(统计比特数)
原题网址:https://leetcode.com/problems/counting-bits/Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation
2016-04-30 08:16:39 661
原创 LeetCode 337. House Robber III(小偷游戏)
原题网址:https://leetcode.com/problems/house-robber-iii/The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root,
2016-04-30 06:12:14 999
原创 LeetCode 336. Palindrome Pairs(回文对)
原题网址:https://leetcode.com/problems/palindrome-pairs/Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e.
2016-04-30 05:34:08 2689 3
原创 LeetCode 335. Self Crossing(贪吃蛇)
原题网址:https://leetcode.com/problems/self-crossing/You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[
2016-04-30 01:55:51 811
原创 LeetCode 334. Increasing Triplet Subsequence(长度为3的递增子序列)
原题网址:https://leetcode.com/problems/increasing-triplet-subsequence/Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the functio
2016-04-29 14:37:07 727
原创 LeetCode 333. Largest BST Subtree(最大二叉搜索树)
原题网址:https://leetcode.com/problems/largest-bst-subtree/Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes
2016-04-29 13:22:12 2208
原创 LeetCode 332. Reconstruct Itinerary(重构行程)
原题网址:https://leetcode.com/problems/reconstruct-itinerary/Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order.
2016-04-29 08:06:51 1617
原创 LeetCode 331. Verify Preorder Serialization of a Binary Tree(校验二叉树的前序遍历序列化)
原题网址:https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record t
2016-04-28 07:36:08 951
原创 LeetCode 330. Patching Array(数组补丁)
原题网址:https://leetcode.com/problems/patching-array/Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive ca
2016-04-28 06:24:51 556
原创 LeetCode 329. Longest Increasing Path in a Matrix(矩阵内的最长递增路径)
原题网址:https://leetcode.com/problems/longest-increasing-path-in-a-matrix/Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four dir
2016-04-28 01:57:37 1635
原创 LeetCode 328. Odd Even Linked List(链表的奇偶调整)
原题网址:https://leetcode.com/problems/odd-even-linked-list/Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number
2016-04-28 01:25:26 495
原创 LeetCode 327. Count of Range Sum(区间和计数)
原题网址:https://leetcode.com/problems/count-of-range-sum/Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive.Range sum S(i, j) is defined as the su
2016-04-28 00:32:14 3701
原创 LeetCode 326. Power of Three(3的n次幂)
原题网址:https://leetcode.com/problems/power-of-three/Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?方
2016-04-26 06:50:28 509
原创 LeetCode 325. Maximum Size Subarray Sum Equals k(和为k的最长子数组)
原题网址:https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0
2016-04-26 06:10:18 2421
原创 LeetCode 324. Wiggle Sort II(摇摆排序)
原题网址:https://leetcode.com/problems/wiggle-sort-ii/Given an unsorted array nums, reorder it such that nums[0] nums[2] .Example:(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is
2016-04-26 04:48:49 2363
原创 LeetCode 323. Number of Connected Components in an Undirected Graph(连通分量)
原题网址:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), wr
2016-04-25 02:50:21 2151
原创 LeetCode 322. Coin Change(兑换硬币)
原题网址:https://leetcode.com/problems/coin-change/You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you
2016-04-25 02:32:12 2420
原创 LeetCode 321. Create Maximum Number(寻找最大数)
原题网址:https://leetcode.com/problems/create-maximum-number/Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k from digits of th
2016-04-25 02:00:54 1971
原创 LeetCode 320. Generalized Abbreviation(产生缩写)
原题网址:https://leetcode.com/problems/generalized-abbreviation/Write a function to generate the generalized abbreviations of a word.Example:Given word = "word", return the following list
2016-04-24 02:39:12 1747
原创 LeetCode 319. Bulb Switcher(灯泡)
原题网址:https://leetcode.com/problems/bulb-switcher/There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle e
2016-04-24 01:14:06 429
原创 LeetCode 318. Maximum Product of Word Lengths(最大单词长度乘积)
原题网址:https://leetcode.com/problems/maximum-product-of-word-lengths/Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share comm
2016-04-23 13:28:40 887 1
原创 LeetCode 317. Shortest Distance from All Buildings(最短建筑距离)
原题网址:https://leetcode.com/problems/shortest-distance-from-all-buildings/You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only
2016-04-23 09:18:04 3481
原创 LeetCode 316. Remove Duplicate Letters(删除重复字母)
原题网址:https://leetcode.com/problems/remove-duplicate-letters/Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You mus
2016-04-23 05:51:58 2204 1
原创 LeetCode 315. Count of Smaller Numbers After Self (逆序数对)
原题网址:https://leetcode.com/problems/count-of-smaller-numbers-after-self/You are given an integer array nums and you have to return a new counts array. The counts array has the property where coun
2016-04-22 13:21:32 7432 2
原创 LeetCode 314. Binary Tree Vertical Order Traversal(二叉树垂直遍历)
原题网址:https://leetcode.com/problems/binary-tree-vertical-order-traversal/Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).
2016-04-22 02:19:07 6028
原创 LeetCode 313. Super Ugly Number(超级丑的数字)
原题网址:https://leetcode.com/problems/super-ugly-number/Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime
2016-04-22 01:41:57 1498
原创 LeetCode 312. Burst Balloons(戳气球)
原题网址:https://leetcode.com/problems/burst-balloons/Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all t
2016-04-21 14:39:10 3576
原创 LeetCode 311. Sparse Matrix Multiplication(稀疏矩阵相乘)
原题网址:https://leetcode.com/problems/sparse-matrix-multiplication/Given two sparse matrices A and B, return the result of AB.You may assume that A's column number is equal to B's row number.
2016-04-21 08:12:23 2877
原创 LeetCode 310. Minimum Height Trees(最小高度树)
原题网址:https://leetcode.com/problems/minimum-height-trees/For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all po
2016-04-21 06:51:54 2993
原创 LeetCode 309. Best Time to Buy and Sell Stock with Cooldown(股票交易)
原题网址:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to
2016-04-20 13:34:58 652
原创 LeetCode 308. Range Sum Query 2D - Mutable(二维区间求和)
原题网址:https://leetcode.com/problems/range-sum-query-2d-mutable/Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower
2016-04-20 10:31:57 1605
原创 LeetCode 307. Range Sum Query - Mutable(区间之和)
原题网址:https://leetcode.com/problems/range-sum-query-mutable/Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function mo
2016-04-20 07:58:00 639
原创 LeetCode 306. Additive Number(加法的数字)
原题网址:https://leetcode.com/problems/additive-number/Additive number is a string whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except
2016-04-20 01:13:12 868
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人