In a 2 dimensional array grid, each value grid[i][j] represents the height of a building…
分类:LeetCode
LeetCode 105 Construct Binary Tree from Preorder and Inorder Traversal
题目描述 Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that dupl…
[LeetCode][Python]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,1]…
695. Max Area of Island
题目地址:https://leetcode.com/problems/max-area-of-island/description/ 大意:这题跟200题很想,200题是求“岛”的个数,这一题是求“岛”的最大面积。可以参…
二刷394. Decode String
Medium Given an encoded string, return it’s decoded string. The encoding rule is: k[encoded_string], whe…
LeetCode[13] - Wiggle Sort
第一遍想太多. 其实做一个fall-through就能把问题解决,原因是因为:这样的fall-through每次在乎两个element,可以一口气搞定,无关乎再之前的elements。 特别的一点:flag来巧妙的掌控山…
[LeetCode] Word Abbreviation 单词缩写
Given an array of n distinct non-empty strings, you need to generate minimal possible abbrevi…
[LeetCode] Valid Triangle Number 合法的三角形个数
Given an array consists of non-negative integers, your task is to count the number of triplets chosen f…
[LeetCode] Find Pivot Index 寻找中枢点
Given an array of integers nums, write a method that returns the “pivot” index of this…
[LeetCode] Swim in Rising Water 在上升的水中游泳
On an N x N grid, each square grid[i][j] represents the elevation at that point (i,…
[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 ‘(‘, ‘)’, ‘{‘, ‘…