ruicore
ruicore
无标题
322 posts
Don't wanna be here? Send us removal request.
ruicore · 5 years ago
Text
LeetCode 432. All Oone Data Structure
LeetCode 432. All Oone Data Structure
Description
Implement a data structure supporting the following operations:
Inc(Key) – Inserts a new key with value 1. Or increments an existing key by 1. Key is guaranteed to be a non-empty string. Dec(Key) – If Key’s value is 1, remove it from the data structure. Otherwise decrements an existing key by 1. If the key does not exist, this function does nothing. Key is guaranteed to be a…
View On WordPress
0 notes
ruicore · 5 years ago
Text
2019·年度总结
2019·年度总结
收获
总结一下,总结一下。  
2019 年是毕业工作的第一年,有些事情值得给自己记录一下,反思一下。
2018 年 11 月的时候签约了东莞团贷网公司,2019 年 2 月份去了东莞, 3 月 4 号正式开始在公司实习。工作主要是偏运维方向。3 月 27 号公司暴雷,老板投案自首,4 月 1 号回到学校重新找工作。  
4 月份的这段时间里,过的是相对比较难受的。睡觉吃饭都很不舒服,虽然不至于寝室难安,但也是当时的心境了。人脑总是有一种倾向,会淡化过去困难时光的内容,只记住让自己快乐的时段,所以总认为回忆是美好的。现在回想 4 月份的感受,淡化了,找到的新的起点就好。    
6 月 20 号来到杭州,休息了几天,7 月 1 号正式入职,开始工作的生活。
2019…
View On WordPress
0 notes
ruicore · 5 years ago
Text
LeetCode 430. Flatten a Multilevel Doubly Linked List
LeetCode 430. Flatten a Multilevel Doubly Linked List
Description
You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a separate doubly linked list. These child lists may have one or more children of their own, and so on, to produce a multilevel data structure, as shown in the example below.
Flatten the list so that all the nodes appear in a…
View On WordPress
0 notes
ruicore · 5 years ago
Text
LeetCode 429. N-ary Tree Level Order Traversal
LeetCode 429. N-ary Tree Level Order Traversal
Description
Given an n-ary tree, return the level order traversal of its nodes’ values.
Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).
Example 1:
Tumblr media
Input: root = [1,null,3,2,4,null,5,6] Output: [[1],[3,2,4],[5,6]] Example 2:
Tumblr media
Example 2:
Input: root =…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 427. Construct Quad Tree
LeetCode 427. Construct Quad Tree
Description
We want to use quad trees to store an N x N boolean grid. Each cell in the grid can only be true or false. The root node represents the whole grid. For each node, it will be subdivided into four children nodes until the values in the region it represents are all the same.
Each node has another two boolean attributes : isLeaf and val. isLeaf is true if and only if the node is a…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 424. Longest Repeating Character Replacement
LeetCode 424. Longest Repeating Character Replacement
Description
Given a string s that consists of only uppercase English letters, you can perform at most k operations on that string.
In one operation, you can choose any character of the string and change it to any other uppercase English character.
Find the length of the longest sub-string containing all repeating letters you can get after performing the above operations.
Note: Both the…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 393. UTF-8 Validation
LeetCode 393. UTF-8 Validation
Description
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:
For 1-byte character, the first bit is a 0, followed by its unicode code. For n-bytes character, the first n-bits are all one’s, the n+1 bit is 0, followed by n-1 bytes with most significant 2 bits being 10. This is how the UTF-8 encoding would work:
Char. number range | UTF-8 octet…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 38. Count and Say
LeetCode 38. Count and Say
Description
The count-and-say sequence is the sequence of integers with the first five terms as following:
1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one 2, then one 1" or 1211.
Given an integer n where 1 ≤ n ≤ 30, generate the nth term of the count-and-say sequence.
Note: Each term of…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 39. Combination Sum
LeetCode 39. Combination Sum
Description
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.
The same repeated number may be chosen from candidates unlimited number of times.
Note:
All numbers (including target) will be positive integers. The solution set must not contain duplicate…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 392. Is Subsequence
LeetCode 392. Is Subsequence
Description
Given a string s and a string t, check if s is subsequence of t.
You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100).
A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 40. Combination Sum II
LeetCode 40. Combination Sum II
Description
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.
Each number in candidates may only be used once in the combination.
Note:
All numbers (including target) will be positive integers. The solution set must not contain duplicate combinations.
Example 1:
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 41. First Missing Positive
LeetCode 41. First Missing Positive
Description
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
Input: [1,2,0] Output: 3
Example 2:
Input: [3,4,-1,1] Output: 2
Example 3:
Input: [7,8,9,11,12] Output: 1
Note:
Your algorithm should run in O(n) time and uses constant extra space.
描述
给定一个未排序的整数数组,找出其中没有出现的最小的正整数。
示例 1:
输入: [1,2,0] 输出: 3
示例 2:
输入:…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 391. Perfect Rectangle
LeetCode 391. Perfect Rectangle
Description
Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover of a rectangular region.
Each rectangle is represented as a bottom-left point and a top-right point. For example, a unit square is represented as [1,1,2,2]. (coordinate of bottom-left point is (1, 1) and top-right point is (2, 2)).
Example 1:
rectangles =…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 390. Elimination Game
LeetCode 390. Elimination Game
Description
There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.
Repeat the previous step again, but this time from right to left, remove the right most number and every other number from the remaining numbers.
We keep repeating the steps again, alternating left to right…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 389. Find the Difference
LeetCode 389. Find the Difference
Description
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input: s = "abcd" t = "abcde" Output: e Explanation: 'e' is the letter that was added.
描述
给定两个字符串 s 和 t,它们只包含小写字母。
字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 388. Longest Absolute File Path
LeetCode 388. Longest Absolute File Path
Description
Suppose we abstract our file system by a string in the following manner:
The string “dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext” represents:
dir subdir1 subdir2 file.ext
The directory dir contains an empty sub-directory subdir1 and a sub-directory subdir2 containing a file file.ext.
The string…
View On WordPress
0 notes
ruicore · 6 years ago
Text
LeetCode 387. First Unique Character in a String
LeetCode 387. First Unique Character in a String
Description
Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.
Examples:
s = "leetcode" return 0. s = "loveleetcode", return 2. Note: You may assume the string contain only lowercase letters.
描述
给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。
案例:
s = "leetcode" 返回 0. s = "loveleetcode", 返回 2.
来源:力扣(LeetCode) 链…
View On WordPress
0 notes