- 博客(146)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode 864. Shortest Path to Get All Keys
864. Shortest Path to Get All Keys We are given a 2-dimensional grid. “.” is an empty cell, “#” is a wall, “@” is the starting point, (“a”, “b”, …) are keys, and (“A”, “B”, …) are locks. We start at t...
2019-02-24 16:45:30
604
原创 LeetCode 502.IPO
502.IPO Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. S...
2019-02-23 17:36:55
431
原创 网易笔试题-堆棋子
题目描述 小易将n个棋子摆放在一张无限大的棋盘上。第i个棋子放在第x[i]行y[i]列。同一个格子允许放置多个棋子。每一次操作小易可以把一个棋子拿起并将其移动到原格子的上、下、左、右的任意一个格子中。小易想知道要让棋盘上出现有一个格子中至少有i(1 ≤ i ≤ n)个棋子所需要的最少操作次数. 输入描述: 输入包括三行,第一行一个整数n(1 ≤ n ≤ 50),表示棋子的个数 第二行为n个棋子的横...
2019-02-21 18:44:24
516
原创 LeetCode 76. Minimum Window Substring
76. Minimum Window Substring Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = “ADOBECODEBANC”, T = “ABC”...
2019-02-17 19:29:18
259
原创 LeetCode 72. Edit Distance
72. Edit Distance Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following 3 operations permitted on a word: Insert a character...
2019-02-17 16:27:22
232
原创 LeetCode 68. Text Justification
68. Text Justification Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your w...
2019-02-17 15:35:41
218
原创 LeetCode 899. Orderly Queue
899. Orderly Queue A string S of lowercase letters is given. Then, we may make any number of moves. In each move, we choose one of the first K letters (starting from the left), remove it, and place i...
2019-02-16 16:45:09
289
原创 LeetCode 44. Wildcard Matching
44. Wildcard Matching Given an input string (s) and a pattern §, implement wildcard pattern matching with support for ‘?’ and ‘*’. '?' Matches any single character. '*' Matches any sequence of charact...
2019-02-16 15:17:11
221
原创 LeetCode 30. Substring with Concatenation of All Words
30. Substring with Concatenation of All Words You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatena...
2019-02-14 19:34:56
321
1
原创 LeetCode 10. Regular Expression Matching
10. Regular Expression Matching Given an input string (s) and a pattern §, implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches zero or mor...
2019-02-14 15:21:57
242
原创 Leetcode 4. Median of Two Sorted Arrays
4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)...
2019-02-13 20:07:17
217
原创 LeetCode 218. The Skyline Problem
A city’s skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings as...
2019-02-13 17:19:01
267
原创 LeetCode 316. Remove Duplicate Letters
(自己开发的博客,欢迎访问)https://www.weiboke.online 316. Remove Duplicate Letters Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. Yo...
2019-02-11 17:08:00
387
原创 leetcode 895. Maximum Frequency Stack
895. Maximum Frequency Stack Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions: push(int x), which pushes an integer x onto the sta...
2019-02-11 16:00:01
340
原创 leetcode 85. Maximal Rectangle
Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area. Example: Input: [ [“1”,“0”,“1”,“0”,“0”], [“1”,“0”,“1”,“1”,“1”], [“1”,“1”,“1”,“1”,“...
2019-02-03 22:10:26
212
原创 LeetCode 42. Trapping Rain Water
42. Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. The above elevation map ...
2019-02-03 20:04:41
288
原创 leetcode 880. Decoded String at Index
880. Decoded String at Index An encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character at a time and the following steps are taken: If the...
2019-02-03 17:03:18
267
原创 907. Sum of Subarray Minimums
欢迎访问我的博客网站 https://www.weiboke.online/posts/page 907. Sum of Subarray Minimums Given an array of integers A, find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the ans...
2019-02-03 16:14:24
191
原创 leetcode 385. Mini Parser
385. Mini Parser Given a nested list of integers represented as a string, implement a parser to deserialize it. Each element is either an integer, or a list – whose elements may also be integers or ot...
2019-02-02 14:11:18
240
原创 Leetcode 173. Binary Search Tree Iterator
173. Binary Search Tree Iterator Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest numb...
2019-02-02 09:54:23
235
原创 leetcode 155.Min Stack 单调栈的简单应用
155. Min Stack 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 stack. ...
2019-02-01 10:23:54
334
原创 Golang HTTP服务器源码简析
自己开发的博客网站,欢迎访问www.weiboke.online 简单用例 mux := http.NewServeMux() mux.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { writer.Write([]byte("ok&
2019-01-21 10:21:06
522
原创 MYSQL 判断某表中某数值是否存在
> select isnull((select × from tableName where conditions)) 以前常喜欢使用COUNT(*)计算条数,其实这样速度会非常的慢,因为会聚集索引进行扫描和计算,read特别多,特别是 cpu 资源占用极大,晚上查了下资料可以使用isnull的方法,使性能最优。 ...
2018-11-21 11:10:48
5619
原创 [WXM] LeetCode 424. Longest Repeating Character Replacement C++
424. Longest Repeating Character Replacement Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the len...
2018-09-06 17:11:08
369
原创 [WXM] LeetCode 395. Longest Substring with At Least K Repeating Characters C++
395. Longest Substring with At Least K Repeating Characters Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no...
2018-09-06 16:15:14
453
原创 [WXM] LeetCode 334. Increasing Triplet Subsequence C++
334. Increasing Triplet Subsequence Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return true if there exist...
2018-09-05 22:51:59
296
原创 [WXM] LeetCode Minimum Moves to Equal Array Elements II C++
Minimum Moves to Equal Array Elements II Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element b...
2018-09-04 23:08:08
244
原创 [WXM] LeetCode 397. Integer Replacement C++
397. Integer Replacement Given a positive integer n and you can do operations as follow: 1.If n is even, replace n with n/2. 2.If n is odd, you can replace n with either n + 1 or n - 1. What is th...
2018-09-04 17:13:57
336
原创 [WXM] LeetCode 201. Bitwise AND of Numbers Range C++
201. Bitwise AND of Numbers Range Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. Example 1: Input: [5,7] Output: 4 ...
2018-09-04 16:02:08
320
原创 [WXM] LeetCode 318. Maximum Product of Word Lengths C++
318. Maximum Product of Word Lengths Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each ...
2018-09-04 15:07:10
352
原创 [WXM] LeetCode 421. Maximum XOR of Two Numbers in an Array C++
421. Maximum XOR of Two Numbers in an Array Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum result of ai XOR aj, where 0 ≤ i, j < n. Could you d...
2018-09-03 09:53:56
282
原创 [WXM] LeetCode 260. Single Number III C++
260. Single Number III Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. Ex...
2018-09-03 08:11:41
295
原创 [WXM] LeetCode 898. Bitwise ORs of Subarrays C++
898. Bitwise ORs of Subarrays We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], …, A[j]] (with i &amp;lt;= j), we take the bitwise OR of all the elements in...
2018-09-02 22:19:31
774
原创 [WXM] LeetCode 137. Single Number II C++
137. Single Number II Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a lin...
2018-09-02 21:37:21
291
原创 [WXM] LeetCode 99. Recover Binary Search Tree C++
99. Recover Binary Search Tree Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2] 1 / ...
2018-09-02 11:26:41
260
原创 [WXM] LeetCode 834. Sum of Distances in Tree C++
834. Sum of Distances in Tree An undirected, connected tree with N nodes labelled 0…N-1 and N-1 edges are given. The ith edge connects nodes edges[i][0] and edges[i][1] together. Return a list ans,...
2018-09-01 22:21:05
533
原创 [WXM] LeetCode 894. All Possible Full Binary Trees C++
894. All Possible Full Binary Trees A full binary tree is a binary tree where each node has exactly 0 or 2 children. Return a list of all possible full binary trees with N nodes. Each element of th...
2018-09-01 17:32:22
480
原创 [WXM] LeetCode 322. Coin Change C++
322. Coin Change You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If tha...
2018-08-30 10:57:52
438
原创 [WXM] LeetCode 523. Continuous Subarray Sum C++
523. Continuous Subarray Sum Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multi...
2018-08-29 16:55:30
289
原创 [WXM] LeetCode 673. Number of Longest Increasing Subsequence C++
673. Number of Longest Increasing Subsequence Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: The two ...
2018-08-29 16:12:24
313
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅