One Edit Distance Given two strings S and T, determine if they are both one edit distance apart. 比较长度法 复杂度 时间 …
分类:LeetCode
Integer Broker
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product o…
算法:从排序数组中删除重复项
ARTS 介绍 ARTS 是「左耳朵耗子」发起的活动,每周至少做一个 leetcode 的算法题,阅读并点评至少一篇英文技术文章,学习至少一个技术技巧,至少分享一篇有观点和思考的技术文章。坚持至少一年!(也就是:Algo…
[LeetCode] Lowest Common Ancestor of a Binary Tree 二叉树的最小共同父节点,Lowest Common Ancestor of a Binary Search Tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to…
[LeetCode] Moving Average from Data Stream 从数据流中移动平均值
Given a stream of integers and a window size, calculate the moving average of all integers in the slidi…
LeetCode | Simplify Path
题目: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", =>&…
【leetcode】72. Edit Distance 编辑距离计算
1. 题目 Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (e…
【Leetcode】11. Container With Most Water 数列中选两个值使得中间的面积最大
1. 题目 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). …
LeetCode | Add Two Numbers(两个链表相加)
题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse ord…
[Leetcode]Remove Duplicates from Sorted Array
描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the…
[LintCode][Union Find] Find the Weak Connected Component in the Directed Graph
Problem Find the number Weak Connected Component in the directed graph. Each node in the graph contains a labe…
Swift LeetCode 系列之46: permutations
https://leetcode.com/problems/permutations/description/ 笨方法采用了递归的方式 class Solution { var res = [[Int]]() var n…