07 2021 档案

摘要:Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.) (Recall that an integer is prime if and only if it 阅读全文
posted @ 2021-07-31 21:36 Grandyang 阅读(466) 评论(0) 推荐(0) 编辑
摘要:You have an infinite number of stacks arranged in a row and numbered (left to right) from 0, each of the stacks has the same maximum capacity. Impleme 阅读全文
posted @ 2021-07-29 22:43 Grandyang 阅读(368) 评论(0) 推荐(0) 编辑
摘要:Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. After doing so, 阅读全文
posted @ 2021-07-27 21:55 Grandyang 阅读(803) 评论(0) 推荐(0) 编辑
摘要:Let the function f(s) be the frequency of the lexicographically smallest character in a non-empty string s. For example, if s = "dcce" then f(s) = 2 b 阅读全文
posted @ 2021-07-26 03:03 Grandyang 阅读(337) 评论(0) 推荐(0) 编辑
摘要:A transaction is possibly invalid if: the amount exceeds $1000, or; if it occurs within (and including) 60 minutes of another transaction with the sam 阅读全文
posted @ 2021-07-22 22:58 Grandyang 阅读(609) 评论(1) 推荐(0) 编辑
摘要:Given a string s, return the last substring of s in lexicographical order. Example 1: Input: s = "abab" Output: "bab" Explanation: The substrings are 阅读全文
posted @ 2021-07-21 23:01 Grandyang 阅读(487) 评论(0) 推荐(0) 编辑
摘要:Given an n x n grid containing only values 0 and 1, where 0 represents water and 1 represents land, find a water cell such that its distance to the ne 阅读全文
posted @ 2021-07-20 22:27 Grandyang 阅读(894) 评论(0) 推荐(0) 编辑
摘要:Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on. Return the smallest level x such that the sum 阅读全文
posted @ 2021-07-17 09:43 Grandyang 阅读(409) 评论(0) 推荐(0) 编辑
摘要:You are given an array of strings words and a string chars. A string is good if it can be formed by characters from chars (each character can only be 阅读全文
posted @ 2021-07-15 09:27 Grandyang 阅读(362) 评论(0) 推荐(0) 编辑
摘要:Design a data structure that efficiently finds the majority element of a given subarray. The majority element of a subarray is an element that occurs  阅读全文
posted @ 2021-07-14 13:21 Grandyang 阅读(479) 评论(0) 推荐(0) 编辑
摘要:Given a string text, we are allowed to swap two of the characters in the string. Find the length of the longest substring with repeated characters. Ex 阅读全文
posted @ 2021-07-09 23:25 Grandyang 阅读(709) 评论(0) 推荐(0) 编辑
摘要:You have d dice and each die has f faces numbered 1, 2, ..., f. Return the number of possible ways (out of fd total ways) modulo 109 + 7 to roll the d 阅读全文
posted @ 2021-07-08 13:08 Grandyang 阅读(1142) 评论(0) 推荐(0) 编辑
摘要:Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. Example 1: Input: date = "2019- 阅读全文
posted @ 2021-07-05 03:54 Grandyang 阅读(362) 评论(0) 推荐(0) 编辑
摘要: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 阅读(585) 评论(0) 推荐(0) 编辑

Fork me on GitHub