随笔分类 -  LeetCode

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 61 下一页
摘要: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 阅读(646) 评论(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 阅读(515) 评论(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 阅读(1740) 评论(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 阅读(814) 评论(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 阅读(601) 评论(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 阅读(759) 评论(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 阅读(1143) 评论(2) 推荐(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 阅读(518) 评论(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 阅读(600) 评论(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 阅读(955) 评论(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 阅读(876) 评论(0) 推荐(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 阅读(1197) 评论(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 阅读(537) 评论(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 阅读(1252) 评论(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 阅读(2205) 评论(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 阅读(802) 评论(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 阅读(1107) 评论(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 阅读(1181) 评论(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 阅读(1111) 评论(2) 推荐(0)
摘要:Given a number N, return true if and only if it is a confusing number, which satisfies the following condition: We can rotate digits by 180 degrees to 阅读全文
posted @ 2021-03-28 12:19 Grandyang 阅读(663) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 61 下一页
Fork me on GitHub