347. Top K Frequent Elements

Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Inpu Leetcode 2019年10月14日 32次浏览

148. Sort List

Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: I Leetcode 2019年10月14日 32次浏览

206. Reverse Linked List

Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list Leetcode 2019年10月14日 33次浏览

1217. Play with Chips

There are some chips, and the i-th chip is at position chips[i]. You can perform any of the two following types of moves any number of times (possibly Leetcode 2019年10月14日 33次浏览

1219. Path with Maximum Gold

In a gold mine grid of size m * n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the ma Leetcode 2019年10月14日 97次浏览

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 by water and is formed by connecting adjacen Leetcode 2019年10月14日 52次浏览

164. Maximum Gap

2019-9-24 Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains le Leetcode 2019年10月14日 36次浏览

221. Maximal Square

Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: Input: 1 0 1 0 0 1 0 1 1 Leetcode 2019年10月14日 31次浏览

1218. Longest Arithmetic Subsequence of Given Difference

Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that th Leetcode 2019年10月14日 39次浏览

141. Linked List Cycle

快慢指针 链表 2019-9-28: 忘记对slow和fast是否为null值进行判断。 题意让找出一条链表中是否有“圈”。简单利用快慢指针遍历即可。 public class Solution { public boolean hasCycle(ListNode head) { Leetcode 2019年10月14日 29次浏览