Design a Phone Directory which supports the following operations: get: Provide a number which is…
分类:LeetCode
[LeetCode] Sliding Window Median 滑动窗口中位数
Median is the middle value in an ordered integer list. If the size of the list is even, there is no mid…
[LeetCode] Number of Distinct Islands II 不同岛屿的个数之二
Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of…
LeetCode 200 Number of Islands
题目描述 Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded…
[Leetcode] Cheapest Flights Within K Stops K次转机最便宜机票
最新更新请见:https://yanjia.me/zh/2019/01/… There are n cities connected by m flights. Each fight starts from …
LeetCode | Permutations(全排列)
Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following p…
217. 存在重复元素
一、题目原型: 给定一个整数数组,判断是否存在重复元素。 如果任何值在数组中出现至少两次,函数返回 true。如果数组中每个元素都不相同,则返回 false。 二、题目意思剖析: 示例 1: 输入: [1,2,3,1] …
[LeetCode][BFS] 317. Shortest Distance from All Buildings
Problem More LeetCode Discussions You want to build a house on an empty land which reaches all buildings in th…
2018-05-11 507. Perfect Number
题意:给你一个数,判断是不是回文数。回文数:一个数从左读和从右读一样(注:最好不要将int转换为string)。 解题思路: 先判断该数是不是负数,如果是负数返回false; 思路一、可以使用一个map将位置与该位置的数…
Leetcode - Power of Three
My code: public class Solution { public boolean isPowerOfThree(int n) { return n > 0 && Math.pow(3,…
[LeetCode By Go 17]485. Max Consecutive Ones
题目 Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1…
[LeetCode] Design Log Storage System 设计日志存储系统
You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that…