Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.anagrams 的意思是两个词用相同的字母组成 比如 “dog" "go...
转载 2015-03-10 20:51:00
68阅读
2评论
https://www.lydsy.com/JudgeOnline/problem.php?id=2653根据题目要求 左端点在[a,b]中 右端点在[c,d]中 那[b+1,c-1]中的数是必须都要选的 而[a,b]中需再选一个右连续段 [c,d]中选一个左连续段将给定序列排序 然后建立主席树 初始每个点都为1 第i棵线段树在第i-1棵基础上 把排序后的第i-1个数对应位置置为-1这...
原创 2022-06-15 21:36:08
44阅读
​Constraints: The number of nodes in the list is in the range [1, 100]. 1 <= Node.val <= 100IdeaUse two pointers. Slow pointer advance one node at a time, while fast pointer advances two n
转载 2021-08-08 12:04:00
58阅读
2评论
Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,...
转载 2015-01-05 20:25:00
61阅读
2评论
Description 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。 给你一个长度为n的序列s。 回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c,d]之间的子序列中,最大的中位数。 其中a<b<c<d。 位置也从0开始标号。
转载 2017-02-14 21:59:00
48阅读
2评论
题目:
原创 2022-11-07 15:36:47
57阅读
给clj大爷跪了。。。。 反正题解网上都有。 注意这个二分然后赋值1/-1,然后判>=0的做法是个套路,仿佛比较常用?
转载 2017-03-08 20:38:00
47阅读
2评论
Description 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。给你一个 长度为n的序列s。回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c,d]之间的子序列中,最大的中位数。 其中a using namespace st
转载 2018-02-06 11:39:00
59阅读
2评论
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2653 [算法] 显然 , 问题具有单调性 , 不妨对于每组询问首先二分答案mid 将大于等于mid的数看作1 , 小于mid的数看作-1 , 问题转化为判断是否有左端点在[l1 , r
转载 2019-03-29 20:30:00
35阅读
题目传送门 Description 有一个长度为 \(n\) 的序列 \(a_{1,2,...,n}\) ,每次可以删掉 \(a_i\),当 \(\min(a_{i-1},a_{i+1})>a_i\) 时。 问每个数在多少次被删掉。\(n\le 10^5\)。 Solution 不知道为什么,碰到这 ...
转载 2021-08-15 18:58:00
66阅读
2评论
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
转载 2015-03-23 14:29:00
53阅读
2评论
Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.题目关键点...
转载 2015-03-11 20:42:00
26阅读
2评论
Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh...
转载 2015-01-08 19:11:00
45阅读
2评论
Sort a linked list inO(nlogn) time using constant space complexity.思路:用归并排序。设输入链表为S,则先将其拆分为前半部分链表A,后半部分链表B。注意,要把A链表的末尾置为NULL。即要把链表划分为两个独立的部分,防止后面错乱。#i...
转载 2015-01-09 22:01:00
92阅读
2评论
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
转载 2015-01-06 10:49:00
2阅读
2评论
[BZOJ2653]middle 试题描述 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。给你一个长度为n的序列s。回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c,d]之间的子序列中,最大的中位数。其中a<b<c<d。位置也从
转载 2017-02-01 16:42:00
28阅读
2评论
If you go a public caffee shop, they have free wifi. How could you make sure your infomration cannot be read by a second person? Well, in HTTP1.1, You
IT
转载 2016-07-02 22:41:00
46阅读
2评论
FJ is surveying his herd to find the most average cow. He wants to know how much milk this ‘median’ co
原创 2022-11-07 14:05:11
91阅读
2653: middle Description 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。给你一个 长度为n的序列s。回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c,d]之间的子序列中,最大的中位数。 其中a<b<c<d
原创 2021-12-31 13:41:45
61阅读
  • 1
  • 2
  • 3
  • 4
  • 5