2019年1月11日

Leetcode 224. Basic Calculator

摘要: Problem: Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the 阅读全文

posted @ 2019-01-11 11:01 周浩炜 阅读(147) 评论(0) 推荐(0) 编辑

Leetcode 84. Largest Rectangle in Histogram

摘要: Problem: 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 阅读全文

posted @ 2019-01-11 09:15 周浩炜 阅读(98) 评论(0) 推荐(0) 编辑

Leetcode 552. Student Attendance Record II

摘要: Problem: Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The ans 阅读全文

posted @ 2019-01-11 06:52 周浩炜 阅读(405) 评论(0) 推荐(0) 编辑

2019年1月10日

Leetcode 358. Rearrange String k Distance Apart

摘要: Problem: Given a non-empty string s and an integer k, rearrange the string such that the same characters are at least distance k from each other. All 阅读全文

posted @ 2019-01-10 14:19 周浩炜 阅读(435) 评论(0) 推荐(0) 编辑

Leetcode 354. Russian Doll Envelopes

摘要: Problem: You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if b 阅读全文

posted @ 2019-01-10 07:06 周浩炜 阅读(155) 评论(0) 推荐(0) 编辑

LCS问题

摘要: 基本思想: 最长递增子序列问题原本是动态规划的经典问题,由于这个问题太经典了,所以我把它单独列在基本算法中。最简单的方法是动态规划,用一个数组dp[i]表示以nums[i]结尾的最长递增子序列的长度,对于每个dp[i],遍历dp[k](k<i),在所有nums[k] < nums[i]的元素中找到最 阅读全文

posted @ 2019-01-10 06:51 周浩炜 阅读(891) 评论(0) 推荐(0) 编辑

Leetcode 295. Find Median from Data Stream

摘要: Problem: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean o 阅读全文

posted @ 2019-01-10 06:26 周浩炜 阅读(526) 评论(0) 推荐(0) 编辑

2019年1月9日

Leetcode 683. K Empty Slots

摘要: Problem: There is a garden with N slots. In each slot, there is a flower. The N flowers will bloom one by one in N days. In each day, there will be ex 阅读全文

posted @ 2019-01-09 15:26 周浩炜 阅读(178) 评论(0) 推荐(0) 编辑

Leetcode 642. Design Search Autocomplete System

摘要: Problem: Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). 阅读全文

posted @ 2019-01-09 13:08 周浩炜 阅读(305) 评论(0) 推荐(0) 编辑

Leetcode 403. Frog Jump

摘要: Problem: A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a sto 阅读全文

posted @ 2019-01-09 06:35 周浩炜 阅读(105) 评论(0) 推荐(0) 编辑

导航