题目如下: You are given two strings s1 and s2 of equal length consisting of letters "x" and "y" only. Your task is to make these two strings equal to each other. You can swap any two characters that belong to different strings, which means…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 动态规划 参考资料 日期 题目地址:https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing/description/ 题目描述 We have two integer sequences A and B of the same non-zero length.…
题目如下: We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i].  Note that both elements are in the same index position in their respective sequences. At the end of some number of swaps, A and B…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 滑动窗口 日期 题目地址:https://leetcode-cn.com/problems/minimum-swaps-to-group-all-1s-together/ 题目描述 Given a binary array data, return the minimum number of swaps required to group all 1'…
题目如下: Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from these points, with sides not necessarily parallel to the x and y axes. If there isn't any rectangle, return 0. Example 1: Input: [[1,2],[2,1],[1,0],[…
[LeetCode]452. Minimum Number of Arrows to Burst Balloons 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description/ 题目描述: There are a number of spherical balloons spread in two-dimensio…
题目如下: 解题思路:本题和[leetcode]583. Delete Operation for Two Strings 类似,区别在于word1[i] != word2[j]的时候,是删除word1[i]还是word2[j]取决于min(dp[i-1][j]+ord(word1[i-1]),dp[i][j-1]+ord(word2[j-1])). 代码如下: class Solution(object): def minimumDeleteSum(self, s1, s2): ""…
今天看到LeetCode OJ题目下方多了"Show Tags"功能.我觉着挺好,方便刚開始学习的人分类练习.同一时候也是解题时的思路提示. [题目] Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/description/ 题目描述 Given two strings s1, s2, find the lowest ASCII sum of deleted characters to ma…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 暴力遍历 日期 题目地址:https://leetcode.com/problems/greatest-common-divisor-of-strings/ 题目描述 For strings S and T, we say "T divides S" if and only if S = T + ... + T (T concatenate…