On an N x N grid, each square grid[i][j] represents the elevation at that point (i,…
分类:LeetCode题目解答
[Leetcode] Power of Two and Power of Four 二之幂四之幂
Power of Two Given an integer, write a function to determine if it is a power of two. 整除法 复杂度 时间 O(1) 空间 O(1) …
【leetcode】20. Valid Parentheses 括号串的合法判断
1. 题目 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘…
[LeetCode] Word Pattern 词语模式
Given a pattern and a string str, find if str follows the same pattern. Examples: pattern = "abba", str…
[LeetCode] Open the Lock 开锁
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3…
[LeetCode] Expressive Words 富于表现力的单词
Sometimes people repeat letters to represent extra feeling, such as “hello” -> “he…
LeetCode 299 Bulls and Cows
题目描述 You are playing the following Bulls and Cows game with your friend: You write down a number and ask your …
LeetCode 201 Bitwise AND of Numbers Range
题目描述 Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in t…
[LeetCode] Remove 9 移除9
Start from integer 1, remove any integer that contains 9 such as 9, 19, 29… So now, you will have…
[LeetCode] Number of Distinct Islands 不同岛屿的个数
Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of…
[LeetCode] My Calendar I 我的日历之一
Implement a MyCalendar class to store your events. A new event can be added if adding the eve…
【leetcode】64. Minimum Path Sum 棋盘最短路径
1. 题目 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which min…