![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 67
xblog_
15网工
展开
-
[LeetCode .213] House Robber II
声明:题目来自LeetcodeYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means th...原创 2019-03-05 18:34:15 · 146 阅读 · 0 评论 -
[LeetCode] Partition Equal Subset Sum划分数组形成两个和相等的子集
声明:原题目转载自LeetCode,解答部分为原创Problem : Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements i原创 2017-05-30 01:58:59 · 3353 阅读 · 0 评论 -
[LeetCode] Target Sum通过添加+/-获得目标结果
声明:原题目转载自LeetCode,解答部分为原创 Problem : You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should原创 2017-05-30 01:36:45 · 871 阅读 · 0 评论 -
[LeetCode] Predict the Winner 预测得分最高的赢家
声明:原题目转载自LeetCode,解答部分为原创Problem : Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2原创 2017-05-29 23:22:15 · 323 阅读 · 0 评论 -
[LeetCode] Excel Sheet Column Number 字符串转数字
声明:原题目转载自LeetCode,解答部分为原创Problem :Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...原创 2017-05-08 22:25:52 · 242 阅读 · 0 评论 -
[LeetCode] First Unique Character in a String 寻找第一个不重复出现的字符
声明:原题目转载自LeetCode,解答部分为原创Problem : Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"ret原创 2017-05-08 22:19:31 · 1135 阅读 · 0 评论 -
[LeetCode] Excel Sheet Column Title 数值按进制转字符
声明:原题目转载自LeetCode,解答部分为原创Problem :Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ...原创 2017-05-08 22:14:05 · 159 阅读 · 0 评论 -
[LeetCode] Sum of Left Leaves 左叶子节点的和
声明:原题目转载自LeetCode,解答部分为原创Problem :Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tr原创 2017-05-08 22:08:47 · 213 阅读 · 0 评论 -
[LeetCode] Integer Break 切割整数,求取最大乘积
Problem :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 maximum product you can get.For exampl原创 2017-05-15 22:50:57 · 343 阅读 · 0 评论 -
[LeetCode] Count Numbers with Unique Digits 计算各位数值不同的数的个数
声明:原题目转载自LeetCode,解答部分为原创Problem : Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n. Example: Given n = 2, return 91. (Th原创 2017-05-15 12:35:57 · 249 阅读 · 0 评论 -
[LeetCode] Jump Game 跳跃游戏
声明:原题目转载自LeetCode,解答部分为原创Problem:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maxim原创 2017-04-23 21:13:31 · 257 阅读 · 0 评论 -
[LeetCode] Longest Palindromic Subsequence 最长回文子序列
声明:原题目转载自LeetCode,解答部分为原创Problem : Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.Example 1:原创 2017-05-30 03:09:56 · 265 阅读 · 0 评论 -
Combination Sum IV 组合数
声明:原题目转载自LeetCode,解答部分为原创Problem :Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.原创 2017-05-30 04:09:38 · 231 阅读 · 0 评论 -
[LeetCode] Combination Sum 和确定的组合数的个数
声明:原题目转载自LeetCode,解答部分为原创Problem : Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbe原创 2017-05-30 04:26:06 · 248 阅读 · 0 评论 -
[LeetCode] Longest Increasing Subsequence 最长递增子序列的长度
声明:原题目转载自LeetCode,解答部分为原创Problem : Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18],原创 2017-06-12 17:04:44 · 543 阅读 · 0 评论 -
[LeetCode] Range Sum Query - Immutable 求部分和
声明:原题目转载自LeetCode,解答部分为原创Problem : Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example:Given nums = [-2, 0, 3, -5,原创 2017-06-12 16:40:54 · 207 阅读 · 0 评论 -
[LeetCode] House Robber II 求循环数组中元素两两不相邻的子序列最大和
声明:原题目转载自LeetCode,解答部分为原创Problem : Note: This is an extension of House Robber. [LeetCode] House Robber After robbing those houses on that street, the thief has found himself原创 2017-06-12 16:28:16 · 1011 阅读 · 0 评论 -
[LeetCode] House Robber 求数组中元素两两不相邻的子序列最大和
声明:原题目转载自LeetCode,解答部分为原创Problem : You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping原创 2017-06-12 15:04:29 · 3338 阅读 · 0 评论 -
[LeetCode] Maximum Product Subarray 求连续子数组的最大乘积
声明:原题目转载自LeetCode,解答部分为原创Problem : Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,原创 2017-06-05 22:56:31 · 2060 阅读 · 0 评论 -
[LeetCode] Maximum Subarray 求连续子数组的最大和
声明:原题目转载自LeetCode,解答部分为原创Problem : Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-原创 2017-06-05 21:52:41 · 2213 阅读 · 0 评论 -
[LeetCode] Climbing stairs 爬楼梯问题
声明:原题目转载自LeetCode,解答部分为原创Problem : You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways c原创 2017-06-05 21:29:54 · 365 阅读 · 0 评论 -
[LeetCode] Is Subsequence 判断一个字符串是否为另一个的子序列
声明:原题目转载自LeetCode,解答部分为原创Problem :Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is p原创 2017-05-21 11:10:41 · 6383 阅读 · 0 评论 -
[LeetCode] Unique Paths II 起点与终点确定的路径数II
声明:原题目转载自LeetCode,解答部分为原创Problem : Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle原创 2017-05-31 01:11:04 · 334 阅读 · 0 评论 -
[LeetCode] Unique Paths 起点与终点确定的路径数
声明:原题目转载自LeetCode,解答部分为原创Problem : A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right原创 2017-05-31 00:01:41 · 491 阅读 · 0 评论 -
[LeetCode] Minimum Depth of Binary Tree 根到叶的最短深度
声明:原题目转载自LeetCode,解答部分为原创Problem: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to t原创 2017-04-23 20:02:19 · 172 阅读 · 0 评论 -
[LeetCode] Assign Cookies 分饼干
声明:原题目转载自LeetCode,解答部分为原创Problem:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a gree原创 2017-04-16 14:37:19 · 273 阅读 · 0 评论 -
[LeetCode] Queue Reconstruction by Height 身高队列
声明:原题目转载自LeetCode,解答部分为原创Problem:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the p原创 2017-04-16 14:01:08 · 294 阅读 · 0 评论 -
[LeetCode] Best Time to Buy and Sell Stock
声明:原题目转载自LeetCode,解答部分为原创Problem : 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 tr原创 2017-04-07 22:46:50 · 159 阅读 · 0 评论 -
[LeetCode] Missing Number
声明:原题目转载自LeetCode,解答部分为原创Problem : Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,原创 2017-04-07 22:11:25 · 216 阅读 · 0 评论 -
[LeetCode] Majority Element 最主要的元素
声明:原题目转载自LeetCode,解答部分为原创Problem: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume th原创 2017-03-13 00:20:02 · 213 阅读 · 0 评论 -
[LeetCode] Island Perimeter 岛屿周长
声明:原题目转载自LeetCode,解答部分为原创Solution: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizon原创 2017-03-11 21:23:55 · 517 阅读 · 0 评论 -
[LeetCode] Fizz Buzz
声明:原题目转载自LeetCode,解答部分为原创Problem :Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number a原创 2017-03-11 20:09:23 · 199 阅读 · 0 评论 -
[LeetCode] Different Ways to Add Parentheses 加括号的不同方式
声明:原题目转载自LeetCode,解答部分为原创Problem :Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The vali原创 2017-03-19 19:11:08 · 319 阅读 · 0 评论 -
[LeetCode]Burst Balloons 爆气球
声明:原题目转载自LeetCode,解答部分为原创Problem: 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 the原创 2017-03-19 17:33:59 · 1347 阅读 · 0 评论 -
[LeetCode]Battleships in a Board 战舰数目
Problem :Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with'.'s. You may assume原创 2017-03-05 21:47:24 · 267 阅读 · 0 评论 -
[LeetCode] Hamming Distance 汉明距离
Problem :The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.原创 2017-02-26 12:18:55 · 533 阅读 · 0 评论 -
[LeetCode] Number Complement 二进制反码
Problem :Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.原创 2017-02-26 14:05:23 · 326 阅读 · 0 评论 -
[LeetCode] Best Time to Buy and Sell Stock II
声明:原题目转载自LeetCode,解答部分为原创Problem : 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原创 2017-04-07 22:58:20 · 195 阅读 · 0 评论 -
[LeetCode] Valid Anagram 有效颠倒
声明:原题目转载自LeetCode,解答部分为原创Problem :Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat",原创 2017-03-26 15:11:47 · 161 阅读 · 0 评论 -
[LeetCode] Intersection of Two Arrays II 两个数组的交集II
声明:原题目转载自LeetCode,解答部分为原创Problem :Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:原创 2017-03-26 15:23:00 · 928 阅读 · 0 评论