Say you have an array for which the ith element is the price of a given stock on day i. Design an algor…
分类:LeetCode题目解答
[LeetCode] Chalkboard XOR Game 黑板亦或游戏
We are given non-negative integers nums[i] which are written on a chalkboard. Alice and Bob take …
LeetCode | Divide Two Integers
题目: Divide two integers without using multiplication, division and mod operator. 思路: 1)考虑边界问题。 2)考虑INT_MIN与INT…
LeetCode 209 Minimum Size Subarray Sum
题目描述 Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of …
LeetCode 169 Majority Element
题目描述 Given an array of size n, find the majority element. The majority element is the element that appears mor…
[Leetcode] One Edit Distance 编辑距离为一
One Edit Distance Given two strings S and T, determine if they are both one edit distance apart. 比较长度法 复杂度 时间 …
[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). …
9. Palindrome Number
9. Palindrome Number 题目 Determine whether an integer is a palindrome. Do this without extra space. click to sh…