2017年8月24日
摘要:
题目描述 给定一个整数,给出消除重复数字以后最大的整数 输入描述: 正整数,注意考虑长整数 输出描述 消除重复数字后的最大整数 示例1 输入 423234 输出 432 思路分析 :要保存原来的顺序这个题目才有意思,如果不保存原来的顺序,那直接一个set就搞定了。 很明显这个数字的最大长度不会超过2
阅读全文
posted @ 2017-08-24 07:56
Beserious
阅读(2386)
推荐(0)
2017年8月23日
摘要:
如果一个01串任意两个相邻位置的字符都是不一样的,我们就叫这个01串为交错01串。例如: "1","10101","0101010"都是交错01串。小易现在有一个01串s,小易想找出一个最长的连续子串,并且这个子串是一个交错01串。小易需要你帮帮忙求出最长的这样的子串的长度是多少。 构造两个交错串然
阅读全文
posted @ 2017-08-23 20:20
Beserious
阅读(330)
推荐(0)
摘要:
小易有一个长度为n的整数序列,a_1,...,a_n。然后考虑在一个空序列b上进行n次以下操作:1、将a_i放入b序列的末尾2、逆置b序列小易需要你计算输出操作n次之后的b序列。 恩deque瞎搞
阅读全文
posted @ 2017-08-23 20:18
Beserious
阅读(285)
推荐(0)
摘要:
题目描述 给定一个数组序列,需要选出一个区间,使得该区间是所有区间中经过如下计算的值最大的一个。 区间中的最小数 * 区间所有数的和 最后程序输出经过计算后的最大值即可,不需要输出具体的区间。如给定序列[6,2,1]可得到左右可以选定各个区间的计算值: [6]=6*6=36 [2]=2*2=4; [
阅读全文
posted @ 2017-08-23 12:04
Beserious
阅读(942)
推荐(0)
摘要:
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutati
阅读全文
posted @ 2017-08-23 08:02
Beserious
阅读(235)
推荐(0)
2017年8月22日
摘要:
Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top
阅读全文
posted @ 2017-08-22 20:55
Beserious
阅读(305)
推荐(0)
2017年8月21日
摘要:
Given an array containing a permutation of 1 to n, you have to find the minimum number of swaps to sort the array in ascending order. A swap means, yo
阅读全文
posted @ 2017-08-21 10:13
Beserious
阅读(180)
推荐(0)
摘要:
题目描述 有N(1<=n<=1000)头奶牛,它们都被标记上一个优先等级编号1,2,3...用来表示它们喝水的优先次序,编号为1的先喝水,编号2的其次。 每天奶牛开始时排成一排,但总是很乱,你要把它们重新排成编号为1的在前,编号为2的其次.... 你能计算出最少需要多少次的交换次序来完成这次重拍吗?
阅读全文
posted @ 2017-08-21 09:28
Beserious
阅读(212)
推荐(0)
2017年8月20日
摘要:
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave
阅读全文
posted @ 2017-08-20 12:26
Beserious
阅读(241)
推荐(0)
摘要:
Given a binary tree with n nodes, your task is to check if it's possible to partition the tree to two trees which have the equal sum of values after r
阅读全文
posted @ 2017-08-20 12:22
Beserious
阅读(311)
推荐(0)