自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(79)
  • 收藏
  • 关注

转载 [LeetCode] 470. Implement Rand10() Using Rand7()

Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer in the range 1 to 10. Do NOT use system's Mat...

2019-09-02 16:13:00 144

转载 [LeetCode] 1137. N-th Tribonacci Number

Description e Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. Given n, return the value of Tn. Example 1: Input: n = 4 Output: 4 E...

2019-08-28 18:20:00 115

转载 [Redis] Redis的基本数据结构

key-value 通过key获取或设置value SET key value GET key SET server:name "fido" GET server:name SETNX : SET-if-not-exists INCR : +1 原子操作 SET connections 10 INCR connections =>11 INCR A =>1 给key设置过...

2019-08-26 20:10:00 100

转载 [LeetCode] 704. Binary Search

Description Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, then return its index, otherwise ...

2019-08-21 13:39:00 71

转载 [LeetCode] 482. License Key Formatting

Description You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we ...

2019-08-09 19:10:00 89

转载 [LeetCode] 1108. Defanging an IP Address

Description Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". Example 1: Input: address = "1.1.1.1" Output...

2019-08-06 11:28:00 94

转载 [LeetCode] 709. To Lower Case

Description Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: ...

2019-08-05 15:28:00 57

转载 [LeetCode] 169. Majority Element

Description Given an array of size \(n\), find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the m...

2019-08-05 11:04:00 67

转载 [LeetCode] 104. Maximum Depth of Binary Tree

Description Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Note: A leaf is a node ...

2019-08-01 11:19:00 55

转载 [LeetCode] 155. Min Stack

Description Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the sta...

2019-07-31 15:51:00 57

转载 [LeetCode] 824. Goat Latin

Description A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the sentence to "Goat Latin" (a made...

2019-07-29 22:20:00 67

转载 [LeetCode] 21. Merge Two Sorted Lists

Description Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3-&g...

2019-07-29 15:53:00 52

转载 [LeetCode] 1021. Remove Outermost Parentheses

Description A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatenation. For example, "", "()", "(...

2019-04-19 20:27:00 53

转载 [Note] Clipboard.js 使用

clipboard.js是一个用来设置剪切板的库,小巧无依赖,但用法有点诡异,必须依赖一个DOM元素 据作者说,由于浏览器相关安全策略的缘故,无法使用下面这种方式来设置剪切板 clipboard.copy('text to copy'); 必须要与一个DOM元素相关联,并且需要用户的点击操作才能实现功能(这样看来,浏览器还是挺安全的) 普通使用推荐下面这种用法,这里的text可以动态设置...

2019-04-11 18:43:00 116

转载 [LeetCode] 665. Non-decreasing Array

Description Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if array[i] <= array[i ...

2019-04-06 15:48:00 51

转载 [LeetCode] 897. Increasing Order Search Tree

Description Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child. Example 1: Inp...

2019-02-20 21:28:00 54

转载 [LeetCode] 136. Single Number

Description Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implemen...

2019-02-19 21:56:00 76

转载 [LeetCode] 822. Card Flipping Game

Description On a table are N cards, with a positive integer printed on the front and back of each card (possibly different). We flip any number of cards, and after we choose one card. If the numb...

2019-01-24 22:11:00 88

转载 [LeetCode] 922. Sort Array By Parity II

Description Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i] is odd, i is odd; and whenever A[...

2019-01-23 22:30:00 64

转载 [LeetCode] 965. Univalued Binary Tree

Description A binary tree is univalued if every node in the tree has the same value. Return true if and only if the given tree is univalued. Example 1: Input: [1,1,1,1,1,null,1] Output: true Exam...

2019-01-22 21:39:00 62

转载 [LeetCode] 961. N-Repeated Element in Size 2N Array

Description In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times. Return the element repeated N times. Example 1: Input: [1,2,3,3] Output:...

2019-01-21 16:17:00 44

转载 [LeetCode] 977. Squares of a Sorted Array

Description Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Example 1: Input: [-4,-1,0,3,10] Outpu...

2019-01-21 16:15:00 50

转载 [LeetCode] 561. Array Partition I

Description Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n...

2019-01-21 16:13:00 46

转载 [LeetCode] 701. Insert into a Binary Search Tree

Description Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is g...

2019-01-18 19:43:00 50

转载 [LeetCode] 509. Fibonacci Number

Description The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is...

2019-01-17 20:15:00 38

转载 [LeetCode] 938. Range Sum of BST

Description Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. ...

2019-01-16 21:54:00 36

转载 [LeetCode] 929. Unique Email Addresses

Description 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 leetcode.com is the domain name. Besi...

2018-12-18 17:17:00 224

转载 [LeetCode] 905. Sort Array By Parity

Description 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 return any answer array that satisf...

2018-10-16 10:04:00 50

转载 [LeetCode] 921. Minimum Add to Make Parentheses Valid

Description Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions ) so that the resulting parentheses string is valid. Formally,...

2018-10-14 23:55:00 62

转载 [LeetCode] 167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numb...

2018-09-14 20:17:00 57

转载 [LeetCode] 66. Plus One

Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each ele...

2018-09-02 17:19:00 47

转载 [LeetCode] 27. Remove Element

Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input ...

2018-08-25 10:39:00 40

转载 [LeetCode] 7. Reverse Integer

Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing wit...

2018-08-21 13:25:00 41

转载 [LeetCode] 2. Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and ret...

2018-08-20 10:52:00 57

转载 [LeetCode] 566. Reshape the Matrix

Description In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. You're given a matrix represente...

2018-08-18 21:00:00 49

转载 [LeetCode] 811. Subdomain Visit Count

A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode...

2018-08-17 12:21:00 61

转载 [LeetCode] 867. Transpose Matrix

Description 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 column indices of the matrix. Example 1: In...

2018-08-15 14:36:00 41

转载 [LeetCode] 412. Fizz Buzz

Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”...

2018-08-14 12:33:00 39

转载 [LeetCode] 383. Ransom Note

Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines...

2018-08-14 11:20:00 69

转载 [LeetCode] 476. Number Complement

Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range of...

2018-08-14 10:58:00 46

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除