自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 695. Max Area of Island

题目Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surro

2017-12-28 19:55:39 148

原创 100. Same Tree

题目Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example 1:I

2017-12-25 20:32:07 155

原创 127. Word Ladder

题目Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be changed at a ti

2017-12-25 19:53:24 173

原创 104. Maximum Depth of Binary Tree

题目Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.题意分析实现/** * Definition for a binary tree

2017-12-25 19:26:15 151

原创 515. Find Largest Value in Each Tree Row

题目You need to find the largest value in each row of a binary tree.Example: Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]题意分析实现/** /** * Definition for a binary tree no

2017-12-25 19:22:23 132

原创 513. Find Bottom Left Tree Value

题目Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Output: 7 N

2017-12-25 19:14:39 160

原创 746. Min Cost Climbing Stairs

题目题意cost数组存放了每一级楼梯的花费, 要经过这一级就要付出相应的花费, 每次可以走1~2级, 可以选择从第0级和第1级开始走, 问走到顶(n)的最少花费是多少?(级数从0开始编号,对应开销cost[0])分析一些转化: 可以选择从第0级和第1级开始走->加一个第-1级,cost为0,从-1级出发 走到顶(n)->加一个第n级, cost为0, 走到第n级才算走完(前一步可以是n-1或者n

2017-12-24 23:51:24 205

原创 638. Shopping Offers

题目题意不同的商品i有不同需求needs[i] 有些特价组合special[],对应每一种商品i有相应的数量,买相应的数量就可以用组合价(但是有一些组合未必会比单买便宜) 求恰好买够需求needs[]的的最低总价.分析用动态规划+DFS 每一次调用遍历一次组合special[i], 看剩余的需求里面能不能用组合i的方式购买,如果可以,则使用组合i,并且减去相应的need的数量,剩余的数量再调用

2017-12-24 23:51:00 380

原创 LL(1)语法分析器 c++实现

结构 记号和规定 代码 Base.h Base.cpp LL1.h LL1.cpp main.cpp 测试样例 结构 main.cpp包含了主函数和LL1语法分析过程的调用 Base.h和Base.cpp定义了类Base, 类Base用于存储产生式、符号表、FIRST集合FOLLOW集(还可应用于LR分析,故独立出来) LL1.h和LL1.cpp定义了类 LL...

2017-12-18 20:21:00 22163 6

原创 63. Unique Paths II

题目 Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in the gr...

2017-12-17 22:54:07 147

原创 740. Delete and Earn

题目 Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every element equal ...

2017-12-17 22:53:12 168

原创 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

2017-12-17 22:51:23 172

原创 152. Maximum Product Subarray

题目 Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the larges...

2017-12-17 22:50:27 145

原创 309. 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 find the maximum profit. You may complete as many transactions as you like (ie, buy one a

2017-12-10 21:03:40 156

原创 416. Partition Equal Subset Sum

题目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 in both subsets is equal.Note: Each of the array elemen

2017-12-03 11:51:45 156

原创 213. House Robber II

题目Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, a

2017-12-03 11:09:43 144

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除