摘要: Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. 阅读全文
posted @ 2019-03-30 11:30 Pickle 阅读(331) 评论(0) 推荐(0) 编辑
摘要: Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You may re 阅读全文
posted @ 2018-12-07 17:11 Pickle 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two. Example 1: Example 2: Input: 5 Output: false判断一个数是否为2的次幂,偶然发现3年前做这道题就是很简单的循环对 阅读全文
posted @ 2018-12-02 16:27 Pickle 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Every email consists of a local name and a domain name, separated by the @ sign. For example, in [email protected], alice is the local name, and leet 阅读全文
posted @ 2018-11-16 21:59 Pickle 阅读(278) 评论(0) 推荐(0) 编辑
摘要: International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" map 阅读全文
posted @ 2018-11-16 21:57 Pickle 阅读(217) 评论(0) 推荐(0) 编辑
摘要: JVM监控和调优 在Java应用和服务出现莫名的卡顿、CPU飙升等问题时总是要分析一下对应进程的JVM状态以定位问题和解决问题并作出相应的优化,在这过程中Java自带的一些状态监控命令和图形化工具就非常方便了。本文总结了最常用的命令行工具及其常用参数解释,图形化监控工具的用法,仅供参考。 jps J 阅读全文
posted @ 2018-11-05 10:08 Pickle 阅读(16324) 评论(4) 推荐(13) 编辑
摘要: Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 反转单链表,看到我 阅读全文
posted @ 2018-10-31 20:29 Pickle 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, swap every two adjacent nodes and return its head. Example: Note: Your algorithm should use only constant extra space. You may no 阅读全文
posted @ 2018-10-31 20:06 Pickle 阅读(235) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2018-10-16 14:44 Pickle 阅读(289) 评论(0) 推荐(0) 编辑
摘要: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2018-10-15 17:14 Pickle 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Note: 解法一:利用s 阅读全文
posted @ 2018-10-15 16:32 Pickle 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文
posted @ 2018-10-10 14:26 Pickle 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 经典问题,判断一个单向链表是否有环,快慢指针,有相遇即有环。 阅读全文
posted @ 2018-10-10 14:21 Pickle 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Input: nums = [1], k = 1 Output: [1] Example 2: Note: 阅读全文
posted @ 2018-09-28 17:03 Pickle 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2018-09-13 16:16 Pickle 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N. If there aren't two co 阅读全文
posted @ 2018-08-30 17:49 Pickle 阅读(288) 评论(0) 推荐(0) 编辑
摘要: This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct, the input array could be 阅读全文
posted @ 2018-08-20 10:38 Pickle 阅读(202) 评论(0) 推荐(0) 编辑
摘要: Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individuall 阅读全文
posted @ 2018-08-20 10:37 Pickle 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same. If possible, output 阅读全文
posted @ 2018-08-20 10:35 Pickle 阅读(228) 评论(0) 推荐(0) 编辑
摘要: A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the m 阅读全文
posted @ 2018-08-20 10:33 Pickle 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil 阅读全文
posted @ 2018-08-16 15:01 Pickle 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example: Note: 阅读全文
posted @ 2018-08-16 14:59 Pickle 阅读(315) 评论(0) 推荐(0) 编辑
摘要: Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The 阅读全文
posted @ 2018-08-16 14:58 Pickle 阅读(176) 评论(0) 推荐(0) 编辑
摘要: You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1' 阅读全文
posted @ 2018-08-16 14:57 Pickle 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2018-07-26 10:36 Pickle 阅读(513) 评论(0) 推荐(0) 编辑