![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构&算法
文章平均质量分 80
Azoobie
这个作者很懒,什么都没留下…
展开
-
动态规划--最小调整代价
91. Minimum Adjustment Cost【题目】Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target.If the array before原创 2016-07-10 22:12:57 · 4797 阅读 · 1 评论 -
动态规划--背包问题
92. BackpackGiven n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack?在n个物品中挑选若干物品装入背包,最多能装多满?【样例】如果有4个物品[2, 3, 5, 7]如果背包原创 2016-07-05 22:13:56 · 1570 阅读 · 0 评论 -
lintcode-N-Queen, N皇后问题
【题目--33. N-Queens】The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n原创 2016-08-14 22:35:05 · 2768 阅读 · 0 评论 -
字符串操作
#include #include #include #include using namespace std;//判断行进方向是否为前向bool forw(string base, string fir, string sec) { int loc1, loc2; loc1 = base.find(fir); if (loc1 == string::npo原创 2016-09-10 22:44:57 · 227 阅读 · 0 评论 -
lintcode178. graph valid tree 图是否是树
【题目】给出 n 个节点,标号分别从 0 到 n - 1 并且给出一个 无向 边的列表 (给出每条边的两个顶点), 写一个函数去判断这张`无向`图是否是一棵树假设我们不会给出重复的边在边的列表当中. 无向边 [0, 1] 和 [1, 0] 是同一条边, 因此他们不会同时出现在我们给你的边的列表当中。Given n nodes labeled from 0 to n -原创 2016-08-13 15:51:35 · 1516 阅读 · 0 评论 -
hihoCoder--1039:字符消除
描述小Hi最近在玩一个字符消除游戏。给定一个只包含大写字母"ABC"的字符串s,消除过程是如下进行的:1)如果s包含长度超过1的由相同字母组成的子串,那么这些子串会被同时消除,余下的子串拼成新的字符串。例如"ABCCBCCCAA"中"CC","CCC"和"AA"会被同时消除,余下"AB"和"B"拼成新的字符串"ABB"。2)上述消除会反复一轮一轮进行,直到新的字符串不包含相邻的相同字符原创 2016-10-13 21:47:06 · 763 阅读 · 0 评论