Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest consecutive e…
分类:LeetCode
LeetCode | Valid Parentheses(括号匹配)
Given a string containing just the characters '(', ')', '{', '}', '[' and '…
算法: Hamming Distance
Hamming Distance 计算两个二进制数中 对应位上不同的数字总数 class Solution { func hammingDistance(_ x: Int, _ y: Int) -> Int { v…
[LeetCode] Fizz Buzz 嘶嘶嗡嗡
Write a program that outputs the string representation of numbers from 1 to n. But for multiples o…
LeetCode 027 Remove Element
题目描述 Given an array and a value, remove all instances of that value in place and return the new length. The or…
LeetCode | Search for a Range(查找数据出现的范围)
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorith…
022 Generate Parentheses[M]
1 题目描述 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.…
Leetcode PHP题解--D8 832. Flipping an Image
832. Flipping an Image 题目链接 832. Flipping an Image 题目分析 题目要求把一个只有0和1的二维数组中的0和1取反变为1和0。即1变0,0变1。 且需要把每行数据倒序过来。 …
Leetcode PHP题解--D12 852. Peak Index in a Mountain Array
852. Peak Index in a Mountain Array 题目链接 852. Peak Index in a Mountain Array 题目分析 这个题目比较简单。要求返回数组中最大值的索引。 思路 先…
[LeetCode] Random Pick Index 随机拾取序列
Given an array of integers with possible duplicates, randomly output the index of a given target number…
[LeetCode] Design Circular Queue 设计环形队列
Design your implementation of the circular queue. The circular queue is a linear data structure in whic…
LeetCode | Sort Colors(荷兰国旗问题)
Given an array with n objects colored red, white or blue, sort them so that objects of the same colo…