class Solution(object): def minimumDeleteSum(self, s1, s2): """ :type s1: str :type s2: str :rtype: int """ # …
分类:LeetCode
LeetCode | Decode Ways
题目: A message containing letters from A-Z is being encoded to numbers using the following mapping: '…
LeetCode 074 Search a 2D Matrix
题目说明 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following …
【leetcode】63. Unique Paths II 有障碍的棋盘走路路径数量
1. 题目 Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How man…
Leetcode - Power of Four
My code: public class Solution { public boolean isPowerOfFour(int num) { return num > 0 && (num &am…
LeetCode:朋友圈
朋友圈 题目叙述: 班上有 N 名学生。其中有些人是朋友,有些则不是。他们的友谊具有是传递性。如果已知 A 是 B 的朋友,B 是 C 的朋友,那么我们可以认为 A 也是 C 的朋友。所谓的朋友圈,是指所有朋友的集合。 …
LeetCode刷题之Two Sum IV - Input is a BST
Problem Given a Binary Search Tree and a target number, return true if there exist two elements in the BST suc…
[LeetCode] Maximum Size Subarray Sum Equals k 最大子数组之和为k
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If ther…
LeetCode | Best Time to Buy and Sell Stock(股票购买和抛售问题)
Say you have an array for which the ith element is the price of a given stock on day i. If you …
Leetcode 102. Binary Tree Level Order Traversal
二叉树层序遍历, Python 3 实现: 源代码已上传 Github,持续更新。 """ 102. Binary Tree Level Order Traversal Given a binary tree, retu…
Leetcode PHP题解--D29 973. K Closest Points to Origin
973. K Closest Points to Origin 题目链接 973. K Closest Points to Origin 题目分析 给一个坐标数组points,从中返回K个离0,0最近的坐标。 其中,用欧…
[leetcode]6. Z 字形变换
题目描述: 将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。 比如输入字符串为 “LEETCODEISHIRING” 行数为 3 时,排列如下: L C I R E T O…