- 博客(530)
- 收藏
- 关注
原创 渣硕2020暑期实习面经
春招也结束了,拿了点offer,因为一开始就没有准备找区块链方向岗位,所以准备的还是研发岗。因为面的比较少,大厂就面了BATD,所以手上的offer并不多:滴滴、腾讯、阿里还有一家创业公司。过程还算顺利,然后拿了offer也就没有再面其他家了,懒=_=。千芯科技-区块链算法实习生面试就一轮,面完了很快就发offer了,也是实习到现在的公司。一家清华系创业公司,做AI、区块链芯片的,...
2020-05-06 18:38:41 2415 3
原创 LeetCode-1488. Avoid Flood in The City
Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over thenthlake, thenthlake becomes full of water. If it rains over a lake which isfull of water, there will be aflood. Your goal is to avoid the floo...
2020-07-01 22:03:37 581
原创 LeetCode-1487. Making File Names Unique
Given an array of stringsnamesof sizen. You will createnfolders in your file systemsuch that, at theithminute, you will create a folder with the namenames[i].Since two filescannothave the same name, if you enter a folder name which is previous...
2020-07-01 21:46:31 456
原创 grin中pow算法-cuckoo cycle的lean算法简单分析
最近实习,接触了一个比较新颖的工作量证明算法:cuckoo-cycle,基本原理是在一个极大二分图中找到一个长度为proofsize的回路。算法介绍在网上都有,就不赘述了:https://www.zuocoin.com/a/news/experience/2019/0401/32897.html讲讲具体的算法细节吧:1.二分图的生成这是一个基于图的pow算法,当然需要生成一个初始化...
2020-05-06 20:50:37 955
原创 LeetCode-1344. Jump Game V
Given an array ofintegersarrand an integerd. In one step you can jump from indexito index:i + xwhere:i + x < arr.lengthand0 <x <= d. i - xwhere:i - x >= 0and0 <x <...
2020-02-03 01:29:53 340
原创 LeetCode-1343. Maximum Product of Splitted Binary Tree
Given a binary treeroot.Split the binary tree into two subtrees by removing1 edge such that the product of the sums of the subtrees are maximized.Since the answermay be too large,return it modu...
2020-02-03 01:08:38 417
原创 LeetCode-1342. Reduce Array Size to The Half
Given an arrayarr. You can choose a set of integers and remove all the occurrences of these integers in the array.Returnthe minimum size of the setso thatat leasthalf of the integers of the ar...
2020-02-03 01:00:26 378
原创 LeetCode-1341. The K Weakest Rows in a Matrix
Given am* nmatrixmatofones(representing soldiers) andzeros(representing civilians), return the indexes of thekweakest rows in the matrix ordered from the weakest to the strongest.A rowi...
2020-02-03 00:59:19 318
原创 LeetCode-1326. Minimum Number of Taps to Open to Water a Garden
There is a one-dimensional garden on the x-axis. The garden starts at the point0and ends at the pointn. (i.e The length of the garden isn).There aren + 1taps locatedat points[0, 1, ..., n]i...
2020-02-02 00:25:10 585
原创 LeetCode-1325. Delete Leaves With a Given Value
Given a binary treerootand an integertarget, delete all theleaf nodeswith valuetarget.Notethat once you delete a leaf node with valuetarget,if it's parent node becomes a leaf node and has t...
2020-02-02 00:16:16 362
原创 LeetCode-1324. Print Words Vertically
Given a strings.Returnall the words vertically in the same order in which they appear ins.Words are returned as a list of strings, complete withspaces when is necessary. (Trailing spaces are not...
2020-02-02 00:14:48 558
原创 LeetCode-1323. Maximum 69 Number
Given a positive integernumconsisting only of digits 6 and 9.Return the maximum number you can get by changingat mostone digit (6 becomes 9, and 9 becomes 6).Example 1:Input: num = 9669...
2020-02-02 00:12:59 275
原创 LeetCode-1319. Number of Operations to Make Network Connected
There arencomputers numbered from0ton-1connected byethernet cablesconnectionsforming a network whereconnections[i] = [a, b]represents a connection between computersaandb. Any computerca...
2020-02-02 00:10:54 518
原创 LeetCode-1318. Minimum Flips to Make a OR b Equal to c
Given 3 positives numbersa,bandc. Return the minimum flips required in some bits ofaandbto make (aORb==c). (bitwise OR operation).Flip operationconsists of changeanysingle bit 1 to 0...
2020-02-02 00:06:04 281
原创 LeetCode-1317. Convert Integer to the Sum of Two No-Zero Integers
Given an integern. No-Zero integer is a positive integer whichdoesn't contain any 0in its decimal representation.Returna list of two integers[A, B]where:AandBare No-Zero integers. A + B ...
2020-02-02 00:05:10 266
原创 LeetCode-1306. Jump Game III
Given an array of non-negative integersarr, you are initially positioned atstartindex of the array. When you are at indexi, you can jumptoi + arr[i]ori - arr[i], check if you can reach toany...
2020-01-30 22:49:55 399
原创 LeetCode-1305. All Elements in Two Binary Search Trees
Given two binary search treesroot1androot2.Return a list containingall the integersfromboth treessorted inascendingorder.Example 1:Input: root1 = [2,1,4], root2 = [1,0,3]Output: ...
2020-01-30 22:47:20 356
原创 LeetCode-1304. Find N Unique Integers Sum up to Zero
Given an integern, returnanyarray containingnuniqueintegers such that they add up to 0.Example 1:Input: n = 5Output: [-7,-1,1,3,4]Explanation: These arrays also are accepted [-5,-1,1,2...
2020-01-30 22:35:15 302
原创 LeetCode-797. All Paths From Source to Target
Given a directed, acyclic graph ofNnodes. Find all possible paths from node0to nodeN-1, and return them in any order.The graph is given as follows: the nodes are 0, 1, ..., graph.length - 1....
2020-01-30 20:59:49 213
原创 LeetCode-1311. Get Watched Videos by Your Friends
There arenpeople, each person has a uniqueidbetween0andn-1. Given the arrayswatchedVideosandfriends, wherewatchedVideos[i]andfriends[i]contain the list of watched videos and the list of ...
2020-01-29 14:08:37 806
原创 LeetCode-1310. XOR Queries of a Subarray
Given the arrayarrof positive integers and the arrayquerieswherequeries[i] = [Li,Ri],for each queryicompute theXORof elements fromLitoRi(that is,arr[Li]xorarr[Li+1]xor...xorarr[R...
2020-01-29 01:29:34 245
原创 素数筛法
高效找出2-n之间的所有素数。#include <iostream>#include <vector>#include <cmath>using namespace std;int n = 1000000;void PrimeSelect(vector<int> &prime, vector<bool> &...
2020-01-10 15:36:53 181
原创 链表快排
具体思路就是两个指针,一个指针i负责分出大小两部分,一个指针j负责遍历,i左边的值都小于等于val,右边值都大于val,递归分治。#include <iostream>#include <vector>using namespace std;struct ListNode { int val; ListNode *next; ListNode(i...
2019-12-31 09:47:26 200 1
原创 LeetCode-1222. Queens That Can Attack the King
On an8x8chessboard, there can be multiple Black Queens and one White King.Given an array of integer coordinatesqueensthat represents the positions of the Black Queens, and a pair of coordinates...
2019-12-27 14:56:36 214
原创 LeetCode-1221. Split a String in Balanced Strings
Balancedstrings are those who have equal quantity of 'L' and 'R' characters.Given a balanced stringssplit it in the maximum amount of balanced strings.Return the maximum amount of splitted bala...
2019-12-27 14:07:46 206
原创 LeetCode-1249. Minimum Remove to Make Valid Parentheses
Given a stringsof'(',')'and lowercase English characters.Your task is to remove the minimum number of parentheses ('('or')',in any positions ) so that the resultingparentheses stringis ...
2019-12-26 17:23:42 477
原创 LeetCode-1248. Count Number of Nice Subarrays
Given an array of integersnumsand an integerk. Asubarrayis calledniceif there arekodd numbers on it.Return the number ofnicesub-arrays.Example 1:Input: nums = [1,1,2,1,1], k = 3O...
2019-12-26 17:04:47 303
原创 LeetCode-1247. Minimum Swaps to Make Strings Equal
You are given two stringss1ands2of equal lengthconsisting of letters"x"and"y"only. Your task is tomake these two strings equal to each other. You can swap any two characters that belong tod...
2019-12-26 15:46:03 418
原创 LeetCode-1289. Minimum Falling Path Sum II
Given a square gridof integersarr, afalling path with non-zero shiftsis a choice ofexactly one element from each row ofarr, such that no two elements chosen in adjacent rows are inthe same colu...
2019-12-26 15:08:40 422
原创 LeetCode-1288. Remove Covered Intervals
Given a list of intervals, remove all intervals that are covered by another interval in the list.Interval[a,b)is covered byinterval[c,d)if and only ifc <= aandb <= d.After doing so, r...
2019-12-26 11:21:29 269
原创 LeetCode-1287. Element Appearing More Than 25% In Sorted Array
Given aninteger arraysortedin non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time.Return that integer.Example 1:Input: arr = [1,2,2,6,6,6...
2019-12-26 11:20:32 167
原创 LeetCode-1286. Iterator for Combination
Design an Iterator class, which has:A constructor that takes a stringcharactersofsorted distinctlowercase English letters and a numbercombinationLengthas arguments. A functionnext()that ret...
2019-12-26 11:19:05 395
原创 LeetCode-1255. Maximum Score Words Formed by Letters
Given a list ofwords, list of singleletters(might be repeating)andscoreof every character.Return the maximum score ofanyvalid set of words formed by using the given letters (words[i]cannot...
2019-12-26 10:09:38 193
原创 LeetCode-1254. Number of Closed Islands
Given a 2Dgridconsists of0s(land)and1s(water). Anislandis a maximal 4-directionally connected group of0sand aclosed islandis an islandtotally(all left, top, right, bottom) surrounded b...
2019-12-25 18:05:16 207
原创 LeetCode-1253. Reconstruct a 2-Row Binary Matrix
Given the following details of a matrix withncolumns and2rows :The matrix is a binary matrix, which means each element in the matrix can be0or1. The sum of elements of the 0-th(upper) row is...
2019-12-25 16:50:40 200
原创 LeetCode-1252. Cells with Odd Values in a Matrix
Givennandmwhich are the dimensions of a matrix initialized by zeros and given an arrayindiceswhereindices[i] = [ri, ci]. For each pair of[ri, ci]you have to increment all cells in rowriand ...
2019-12-25 16:49:10 280
原创 LeetCode-1277. Count Square Submatrices with All Ones
Given am * nmatrix of ones and zeros, return how manysquaresubmatrices have all ones.Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1]]Output: 15Explanation: There are ...
2019-12-25 15:51:14 349
原创 LeetCode-1276. Number of Burgers with No Waste of Ingredients
Given two integerstomatoSlicesandcheeseSlices. The ingredients of different burgers are as follows:Jumbo Burger:4 tomato slicesand 1 cheese slice. Small Burger:2 Tomato slicesand 1 cheese sl...
2019-12-25 15:42:17 213
原创 LeetCode-1298. Maximum Candies You Can Get from Boxes
Givennboxes, each box is given in the format[status, candies, keys, containedBoxes]where:status[i]: an integer which is1ifbox[i]is open and0ifbox[i]is closed. candies[i]:an integer rep...
2019-12-25 14:54:39 195
原创 LeetCode-1296. Divide Array in Sets of K Consecutive Numbers
Given an array of integersnumsand a positive integerk, find whether it's possible to divide this array intosets ofkconsecutive numbersReturnTrueif its possibleotherwisereturnFalse.Exa...
2019-12-24 16:43:49 428
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人