- 博客(27)
- 收藏
- 关注
翻译 习题8.15
题目Show that the following problem is NP-complete. MAXIMUM COMMON SUBGRAPH Input: Two graphs G1 = (V1, E1) and G2 = (V2, E2); a budget b. Output: Two set of nodes V1′ ⊆ V1 and V2′ ⊆ V2 whose delet
2018-01-18 12:41:13
363
原创 LeetCode题解系列--763. Partition Labels
描述A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representin
2018-01-18 12:24:31
723
原创 LeetCode题解系列--309. Best Time to Buy and Sell Stock with Cooldown
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy
2018-01-18 01:00:16
465
原创 LeetCode题解系列--188. Best Time to Buy and Sell Stock IV
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note: You may no
2018-01-17 16:53:55
373
原创 LeetCode题解系列--123. Best Time to Buy and Sell Stock III
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may
2018-01-17 13:33:24
243
原创 LeetCode题解系列--122. Best Time to Buy and Sell Stock II
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy
2018-01-17 11:54:15
239
原创 LeetCode题解系列--121. Best Time to Buy and Sell Stock
描述Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock
2018-01-17 11:48:11
235
原创 Matlab使用笔记-uint8类型之间的运算的坑
在matlab中,uint8的为无符号8位整数,范围 : [0 255],那么当越界时会发生什么呢?小于0:>> uint8(-1)ans = 0大于255:uint8(266)ans = 255这都比较自然,没什么。我今天遇到的使我犯错的是这样一个东西,如果两个uint8相减产生了越界会发生什么呢?我之前一直以为matlab会将类型进行转换,然而实际上并不会,运算后结果仍旧是uint8>>
2017-12-23 11:06:11
14937
原创 LeetCode题解系列--714. Best Time to Buy and Sell Stock with Transaction Fee
描述Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many t
2017-12-13 16:39:53
997
原创 数字图像处理-提取A4纸中线条-matlab的轮廓提取方法
这篇文章主要讲述的是使用一种十分naive的方法通过matlab实现以下轮廓提取的任务: 输入是一张A4纸: 需要分别输出纸上7个线条所在的区域: 思路首先将线条提取出来,然后找出暗处连通的区域,在一个连通的区域中找出最小和最大的横纵坐标,根据横纵坐标圈出一块矩形区域即可。实现1 将彩色图转为灰度图input = imread('input.jpg');input_gray = rgb2
2017-12-07 23:17:20
9379
原创 LeetCode题解系列--712. Minimum ASCII Delete Sum for Two Strings
描述Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1: Input: s1 = “sea”, s2 = “eat” Output: 231 Explanation: Deleting “s” from “sea” adds t
2017-11-02 19:52:01
747
原创 LeetCode题解系列--718. Maximum Length of Repeated Subarray
描述Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The repeated subar
2017-11-01 21:29:40
2065
原创 LeetCode题解系列--685. Redundant Connection II
描述In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, exce
2017-10-18 14:38:06
1739
原创 LeetCode题解系列--684. Redundant Connection
描述In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, …, N), with one additiona
2017-10-10 14:36:22
372
原创 LeetCode题解系列--215. Kth Largest Element in an Array
描述Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k = 2, return 5.Note
2017-09-18 10:30:22
432
原创 LeetCode题解系列--5. Longest Palindromic Substring
描述Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “bab”Note: “aba” is also a valid answer. Example:Inpu
2017-09-09 14:29:49
266
原创 LeetCode题解系列--1. Two Sum
描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same e
2017-09-09 14:14:58
293
原创 LeetCode题解系列--4. Median of Two Sorted Arrays
描述: There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
2017-09-06 20:14:04
423
原创 Unity3D学习笔记(四)牧师和魔鬼游戏改进
在上次做的牧师和魔鬼的游戏中,场记基本负责了所有的工作,加载资源,移动游戏对象,很明显这样的游戏结构很难维护,很难拓展,很不面向对象,所以这次的工作就是利用工厂模式来生产动作。弥补了上次没有上船动作的缺点。先上UML图: UML图实在是花的丑,有空再改。工厂模式解释:CCAction, CCSequenceAction等就是工厂,他的产品就是SSAction,由SSActionManager统一管
2017-03-21 23:39:54
407
原创 Unity3D笔记(三)牧师和魔鬼的游戏
这次做的是一个魔鬼和牧师的游戏 游戏DEMO Priests and Devils is a puzzle game in which you will help the Priests and Devils to cross the river within the time limit. There are 3 priests and 3 devils at one side
2017-03-21 11:39:46
485
原创 Unity3D笔记(二)使用GUI做井字棋小游戏
第一次使用unity, 做点事情就比较笨。简单的事情也做了许久,主要是对unity这个引擎逻辑不熟悉,对C#这个语言的逻辑也不是很熟,走了许多弯路。开始想的是真的有九个格子那样的对象,然后有一个中控对象去负责统计结果,然后发现对象之间的通讯好像还有点麻烦,现在没有太多时间去深入学习,所以使用了简单一些的使用方式,全部都是GUI来做,只用一个脚本。 首先就是创建9个格子:GUI.Button(new
2017-03-07 15:37:24
704
原创 Unity3D笔记(一)基础知识学习笔记
一、解释对象与资源的区别与联系,根据官方案例,分别总结资源和对象组织的规则/规律资源指的是游戏中那些直接可见的、对用户展现出的元素,包括图片、音乐、视频、人物、字体。 对象指的是数据?资源的载体? 资源可以被很多对象复用,很多资源构成游戏的场景。 资源的组织:首先按照大类分为音频、视频、字体、图片等,再往下可能是按照场景划分。对象的组织:可以按照玩家、环境、摄像机、音乐等进行分类,这些父类本身
2017-03-07 14:45:50
915
原创 C++读取文件为何会多读一行?
近来在做概率统计的作业,由于手算均值中值什么的,还有画茎叶图太麻烦,所以写了个小程序。但是当我算到最后时却发现这个小程序有一个bug,然后就gg了。这个bug大概是这样的: 原本在data.txt中只有三个数,读到内存中却有四个数。 正确的结果应该是这样:出事的代码如下:#include <iostream>#include <fstream>#include <vector>#inclu
2016-09-01 16:02:16
6180
7
转载 C++类型转换函数(类型转换运算符函数)
转载自:http://c.biancheng.net/cpp/biancheng/view/222.html> 用转换构造函数可以将一个指定类型的数据转换为类的对象。但是不能反过来将一个类的对象转换为一个其他类型的数据(例如将一个Complex类对象转换成double类型数据)。C++提供类型转换函数(type conversion function)来解决这个问题。类型转换函数的作用是将一个类的
2016-05-30 00:06:51
375
原创 C++之继承
C++ 继承 语法 程序设计 软件工程若有理解不当,欢迎各位指正!作者:吴博文 中山大学数据科学与计算机学院 本人博客:http://blog.youkuaiyun.com/bowen_wu_一、继承基本概念通过继承,所构建的新的类是基于可靠的基类(base class),所以通过这种机制,可以提高代码的复用率(reuseability),从而减少新类的调试的工作量,从而提高编码的效率。同时,由于存在继承这个
2016-04-19 21:02:45
668
原创 CONTAINER类之心得体会
其实容器类就是一个有各种容器的接口,通过C++继承与多态的特性,能够自由的往容器类中添加各种数据结构。上图就是这个容器类的基本结构。其中带箭头的线表示继承关系、带矩形的线表示组成关系、带圆形的线表示这个类是一个纯虚类(可以理解成接口)为了编码的便捷,在下面的编码中我并没有自己写排序的算法,而是调用了algorithm 中的std::sort()函数.Collection.hpp// Created
2016-04-17 11:38:32
791
转载 欢迎使用优快云-markdown编辑器
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl
2016-04-17 11:25:47
299
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人