上一页 1 2 3 4 5 6 7 8 9 ··· 44 下一页
摘要: You are given a string text. You should split it to k substrings (subtext1, subtext2, ..., subtextk) such that: subtexti is a non-empty string. The co 阅读全文
posted @ 2021-07-04 05:01 Grandyang 阅读(582) 评论(0) 推荐(0) 编辑
摘要: Implement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given len 阅读全文
posted @ 2021-06-26 14:14 Grandyang 阅读(1413) 评论(0) 推荐(0) 编辑
摘要: Two players play a turn based game on a binary tree. We are given the root of this binary tree, and the number of nodes n in the tree. n is odd, and e 阅读全文
posted @ 2021-06-21 13:30 Grandyang 阅读(765) 评论(0) 推荐(0) 编辑
摘要: Given an array nums of integers, a move consists of choosing any element and decreasing it by 1. An array A is a zigzag array if either: Every even-in 阅读全文
posted @ 2021-06-21 04:07 Grandyang 阅读(305) 评论(0) 推荐(0) 编辑
摘要: Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of 阅读全文
posted @ 2021-06-18 12:57 Grandyang 阅读(1669) 评论(0) 推荐(0) 编辑
摘要: Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn' 阅读全文
posted @ 2021-06-13 15:47 Grandyang 阅读(515) 评论(0) 推荐(0) 编辑
摘要: On an alphabet board, we start at position (0, 0), corresponding to character board[0][0]. Here, board = ["abcde", "fghij", "klmno", "pqrst", "uvwxy", 阅读全文
posted @ 2021-06-11 13:57 Grandyang 阅读(441) 评论(0) 推荐(0) 编辑
摘要: The 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. Exa 阅读全文
posted @ 2021-06-08 21:59 Grandyang 阅读(684) 评论(0) 推荐(0) 编辑
摘要: Given two arrays of integers with equal lengths, return the maximum value of: |arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j| where the maximum is 阅读全文
posted @ 2021-06-07 05:45 Grandyang 阅读(421) 评论(0) 推荐(0) 编辑
摘要: Given an array arr of positive integers, consider all binary trees such that: Each node has either 0 or 2 children; The values of arr correspond to th 阅读全文
posted @ 2021-05-30 07:45 Grandyang 阅读(1086) 评论(4) 推荐(0) 编辑
摘要: Consider a directed graph, with nodes labelled 0, 1, ..., n-1. In this graph, each edge is either red or blue, and there could be self-edges or parall 阅读全文
posted @ 2021-05-27 11:56 Grandyang 阅读(877) 评论(0) 推荐(0) 编辑
摘要: Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a==c and b==d), or (a==d and b==c) - that 阅读全文
posted @ 2021-05-24 02:24 Grandyang 阅读(395) 评论(0) 推荐(0) 编辑
摘要: In a project, you have a list of required skills req_skills, and a list of people. The ith person people[i] contains a list of skills that the person 阅读全文
posted @ 2021-05-19 11:37 Grandyang 阅读(719) 评论(0) 推荐(0) 编辑
摘要: We are given hours, a list of the number of hours worked per day for a given employee. A day is considered to be a tiring day if and only if the numbe 阅读全文
posted @ 2021-05-16 01:22 Grandyang 阅读(683) 评论(0) 推荐(0) 编辑
摘要: Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the 阅读全文
posted @ 2021-05-13 12:32 Grandyang 阅读(608) 评论(0) 推荐(0) 编辑
摘要: 博主在用 Hexo 搭建博客的时候,一直在考虑评论系统用什么,最终比较了多家,决定用 Gitalk,这是一个基于 Github Issues 的评论系统,所有的评论内容都保存在 Github Issues 中,每篇博客对应一个 Issues。只有登陆 Github 账号才能评论,大多数人应该都会有 阅读全文
posted @ 2021-05-12 12:13 Grandyang 阅读(634) 评论(0) 推荐(0) 编辑
摘要: A string is a valid parentheses string (denoted VPS) if and only if it consists of "(" and ")" characters only, and: It is the empty string, or It can 阅读全文
posted @ 2021-05-09 22:38 Grandyang 阅读(443) 评论(0) 推荐(0) 编辑
摘要: Given the root of a binary tree, each node in the tree has a distinct value. After deleting all nodes with a value in to_delete, we are left with a fo 阅读全文
posted @ 2021-05-09 02:33 Grandyang 阅读(1685) 评论(0) 推荐(0) 编辑
摘要: There are n flights that are labeled from 1 to n. You are given an array of flight bookings bookings, where bookings[i] = [firsti, lasti, seatsi] repr 阅读全文
posted @ 2021-05-06 12:25 Grandyang 阅读(770) 评论(0) 推荐(0) 编辑
摘要: Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". Example 1: 阅读全文
posted @ 2021-05-05 12:48 Grandyang 阅读(572) 评论(0) 推荐(0) 编辑
摘要: Return the result of evaluating a given boolean expression, represented as a string. An expression can either be: "t", evaluating to True; "f", evalua 阅读全文
posted @ 2021-05-02 06:41 Grandyang 阅读(666) 评论(0) 推荐(0) 编辑
摘要: When you run hexo g, you might get the following error: call_and_retry_last allocation failed - javascript heap out of memory Solution: Try to run exp 阅读全文
posted @ 2021-04-26 02:50 Grandyang 阅读(220) 评论(0) 推荐(0) 编辑
摘要: We have a sequence of books: the i-th book has thickness books[i][0] and height books[i][1]. We want to place these books in order onto bookcase shelv 阅读全文
posted @ 2021-04-22 15:56 Grandyang 阅读(1071) 评论(2) 推荐(0) 编辑
摘要: When use nginx to configure https with ssl 443 port, it might be timed out, but your http 80 port work correctly. At this time, if you nginx configure 阅读全文
posted @ 2021-04-20 16:15 Grandyang 阅读(96) 评论(0) 推荐(0) 编辑
摘要: In an infinite binary tree where every node has two children, the nodes are labelled in row order. In the odd numbered rows (ie., the first, third, fi 阅读全文
posted @ 2021-04-15 15:55 Grandyang 阅读(481) 评论(0) 推荐(0) 编辑
摘要: Once you deployed the hexo with Nginx on your web instance, you might get the 403 forbidden error, try the following step to fix: Solution: Run vim /e 阅读全文
posted @ 2021-04-11 17:18 Grandyang 阅读(211) 评论(0) 推荐(0) 编辑
摘要: When you run hexo g on any web instances, like on AWS or Azure, you might get the following error: (node:3568) ExperimentalWarning: The fs.promises AP 阅读全文
posted @ 2021-04-11 10:07 Grandyang 阅读(149) 评论(0) 推荐(0) 编辑
摘要: We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to t 阅读全文
posted @ 2021-04-09 16:24 Grandyang 阅读(555) 评论(0) 推荐(0) 编辑
摘要: Under a grammar given below, strings can represent a set of lowercase words. Let's use R(expr) to denote the set of words the expression represents. G 阅读全文
posted @ 2021-04-07 14:32 Grandyang 阅读(912) 评论(0) 推荐(0) 编辑
摘要: (This problem is an interactive problem.) You may recall that an array A is a mountain array if and only if: A.length >= 3 There exists some i with 0 阅读全文
posted @ 2021-04-04 16:10 Grandyang 阅读(822) 评论(0) 推荐(0) 编辑
摘要: When running hexo server, you might get the following error: console.js:35 throw new TypeError('Console expects a writable stream instance'); ^ TypeEr 阅读全文
posted @ 2021-04-03 15:05 Grandyang 阅读(858) 评论(0) 推荐(0) 编辑
摘要: Sometimes your hexo environment may get fucked up, may give you the following errors: ERROR Local hexo not found in /YourProjectPath/ ERROR Try runnin 阅读全文
posted @ 2021-04-03 13:56 Grandyang 阅读(166) 评论(7) 推荐(0) 编辑
摘要: You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot turn around an 阅读全文
posted @ 2021-04-02 13:04 Grandyang 阅读(1129) 评论(1) 推荐(0) 编辑
摘要: You are given a large sample of integers in the range [0, 255]. Since the sample is so large, it is represented by an array count where count[k] is th 阅读全文
posted @ 2021-04-01 15:33 Grandyang 阅读(516) 评论(0) 推荐(0) 编辑
摘要: Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If multiple answers exist, you may return any 阅读全文
posted @ 2021-03-30 15:44 Grandyang 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path in a 阅读全文
posted @ 2021-03-29 03:52 Grandyang 阅读(2041) 评论(0) 推荐(0) 编辑
摘要: We have a set of items: the i-th item has value values[i] and label labels[i]. Then, we choose a subset S of these items, such that: |S| <= num_wanted 阅读全文
posted @ 2021-03-28 14:59 Grandyang 阅读(777) 评论(0) 推荐(0) 编辑
摘要: Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond 阅读全文
posted @ 2021-03-28 12:30 Grandyang 阅读(1036) 评论(0) 推荐(0) 编辑
摘要: We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. When 2, 3, 阅读全文
posted @ 2021-03-28 12:24 Grandyang 阅读(1134) 评论(0) 推荐(1) 编辑
摘要: On a campus represented as a 2D grid, there are N workers and M bikes, with N <= M. Each worker and bike is a 2D coordinate on this grid. Our goal is 阅读全文
posted @ 2021-03-28 12:20 Grandyang 阅读(1011) 评论(2) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 44 下一页
Fork me on GitHub