随笔分类 - LeetCode Solutions
摘要:Problem : Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole arra
阅读全文
摘要:Problem : Given a string, find the length of the longest substring without repeating characters. Example 1: Example 2: Example 3: 思路 : Solution (C++)
阅读全文
摘要:Problem : Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see
阅读全文
摘要:Problem : Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both?
阅读全文
摘要:Problem : Given a matrix which is sorted in non increasing order both row wise and column wise. Return the number of negative numbers in . Example 1:
阅读全文
摘要:Problem : Implement FreqStack, a class which simulates the operation of a stack like data structure. FreqStack has two functions: push(int x), which p
阅读全文
摘要:Problem : Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) Push element x onto stack. pop() R
阅读全文
摘要:Problem : 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
阅读全文
摘要:Problem : Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object wit
阅读全文
摘要:Problem : Implement the following operations of a queue using stacks. push(x) Push element x to the back of queue. pop() Removes the element from in f
阅读全文
摘要:Problem : You have a list of words and a pattern, and you want to know which words in words matches the pattern. A word matches the pattern if there e
阅读全文
摘要:Problem : Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N. If there are
阅读全文
摘要:Problem : Given a non empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the se
阅读全文
摘要:Problem : Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and
阅读全文
摘要:Problem : Let's call an array A a mountain if the following properties hold: A.length = 3 There exists some 0 A[i+1] ... A[A.length 1] Given an array
阅读全文
摘要:Problem : There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N 1, and each room may have some keys to access
阅读全文
摘要:Problem : Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontal
阅读全文
摘要:Problem : Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Examp
阅读全文
摘要:Problem : A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to c
阅读全文
摘要:Problem : We are given head, the head node of a linked list containing unique integer values. We are also given the list G, a subset of the values in
阅读全文

浙公网安备 33010602011771号