摘要:一、题目 某数学兴趣小组有 N 位同学,编号为 0 ~ N-1,老师提议举行一个数字默契小测试:首先每位同学想出一个数字,按同学编号存于数组 numbers。每位同学可以选择将自己的数字进行放大操作,每次在以下操作中任选一种(放大操作不限次数,可以不操作): 将自己的数字乘以 2 将自己的数字乘以
阅读全文
摘要:本文介绍了一种求解LeetCode 5399的一种解法。通过模拟寻找十进制镜像数字,然后判断其对应的k进制表示是否也是镜像,直到得到n个镜像数字。
阅读全文
摘要:本文介绍了一种使用BFS求解LeetCode第2045题的方法。
阅读全文
摘要:一、题意 You are given a string s containing lowercase letters and an integer k. You need to : First, change some characters of s to other lowercase Engli
阅读全文
摘要:一、题意 Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other wor
阅读全文
摘要:一、题意 Given a string s, we make queries on substrings of s. For each query queries[i] = [left, right, k], we may rearrange the substring s[left], ...,
阅读全文
摘要:转载自:https://www.cnblogs.com/flightless/p/10745318.html class Solution { public: static bool cmp(int a, int b){ return a>b; } int main(vector<int>& vec
阅读全文
摘要:一、题意 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
阅读全文
摘要:题目描述 Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.样例 Example 1:
阅读全文
摘要:题目 给定一个字符串 (s) 和一个字符模式 (p)。实现支持 '.' 和 '*' 的正则表达式匹配。 '.' 匹配任意单个字符。 '*' 匹配零个或多个前面的元素。 匹配应该覆盖整个字符串 (s) ,而不是部分字符串。 说明 s 可能为空,且只包含从 a-z 的小写字母。p 可能为空,且只包含从
阅读全文
摘要:题目 你有一个单词列表 words 和一个模式 pattern,你想知道 words 中的哪些单词与模式匹配。 如果存在字母的排列 p ,使得将模式中的每个字母 x 替换为 p(x) 之后,我们就得到了所需的单词,那么单词与模式是匹配的。 (回想一下,字母的排列是从字母到字母的双射:每个字母映射到另
阅读全文
摘要:题目描述: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occ
阅读全文