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 周浩炜 阅读(434) 评论(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 周浩炜 阅读(885) 评论(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 周浩炜 阅读(524) 评论(0) 推荐(0) 编辑

导航