leetcode Add to List 229. Majority Element II ---------- java
摘要:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. Gi
阅读全文
leetcode 228. Summary Ranges ---------- java
摘要:Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 很简单的一
阅读全文
leetcode 225. Implement Stack using Queues 利用队列构建栈 ---------- java
摘要:Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. to
阅读全文
leetcode 224. Basic Calculator ---------- java
摘要:Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or
阅读全文
leetcode 223. Rectangle Area 计算面积---------- java
摘要:Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner as s
阅读全文
leetcode 222. Count Complete Tree Nodes 统计节点个数---------- java
摘要:Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex
阅读全文
leetcode 链表题总结
摘要:按照frequency来排序,总共27题 1、2. Add Two Numbers https://leetcode.com/problems/add-two-numbers/#/description 两个链表相加,注意就是进位问题。 2、237. Delete Node in a Linked
阅读全文
leetcode 221. Maximal Square 求一个数组中由1组成的最大的正方形面积 ---------- java
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following ma
阅读全文
leetcode 220. Contains Duplicate III 求一个数组中有没有要求的元素 ---------- java
摘要:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and
阅读全文
leetcode 219. Contains Duplicate II 求一个数组中有没有重复元素 ---------- java
摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]and the a
阅读全文
leetcode 1 - 5 解题思路
摘要:1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input wo
阅读全文
leetcode 217. Contains Duplicate 求一个数组中有没有重复元素 ---------- java
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr
阅读全文
leetcode 216. Combination Sum III 求和III ---------- java
摘要:Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be
阅读全文
leetcode 215. Kth Largest Element in an Array 寻找第k个大的数---------- java
摘要:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For exam
阅读全文
leetcode 214. Shortest Palindrome 构造最短回文串---------- java
摘要:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f
阅读全文
leetcode 213. House Robber II 抢劫房子II---------- java
摘要:Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so tha
阅读全文
leetcode 212. Word Search II Add to List 查找单词---------- java
摘要:Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adja
阅读全文
leetcode 211. Add and Search Word - Data structure design 设计一个数据结构用来存储word---------- java
摘要:Design a data structure that supports the following two operations: search(word) can search a literal word or a regular expression string containing o
阅读全文
leetcode 210. Course Schedule II 课程计划 II ---------- java
摘要:There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have t
阅读全文
leetcode 209. Minimum Size Subarray Sum 找出最小的和的长度 ---------- java
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't
阅读全文