自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 资源 (2)
  • 收藏
  • 关注

原创 烹饪实验问题归约3SAT问题| NP-完全问题归约

题目该题目是选自《算法概论》中第8章课后练习题第16题。 题目如下:解题思路该题目可以把烹饪实验问题中构造一个特例,使得它能够满足3SAT的形式即可。 我们首先假设有n个材料,分别为X1,X2,X3……Xn,他们之间有一个关系,对于Xi与Xj之间有不和谐度Dij。在这里,我们构造一个特例,令P=0。 对于每个i与j之间构造四个子句 (Xi V Xj V ~Dij) 、(~Xi V ~Xj V

2016-12-27 00:36:15 1121

原创 LeetCode 403. Frog Jump|动态规划

题目描述A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.Given a list of

2016-11-14 14:15:25 576

原创 LeetCode 210. Course Schedule II|图问题.拓扑排序

题目描述There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a p

2016-11-14 10:39:35 430

原创 LeetCode 45. Jump Game II|贪心算法

题目描述Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to

2016-11-14 00:47:47 652

原创 LeetCode 55. Jump Game|贪心算法

题目描述Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you

2016-11-14 00:29:29 586

原创 LeetCode 115. Distinct Subsequences| 动态规划

题目描述Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none

2016-11-13 20:59:40 213

原创 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.e.g. 3 4 2 1 6 9 2

2016-11-13 15:09:01 314

原创 LeetCode413 Arithmetic Slices| 动态规划

题目描述Arithmetic Slices QuestionEditorial Solution My Submissions Total Accepted: 4238 Total Submissions: 7915 Difficulty: Medium Contributors: XiangyuLi926 A sequence of number is called arithm

2016-11-02 15:30:24 375

原创 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)).leetcode原题链接算法分析这个题目要求实际上挺严

2016-10-10 15:00:52 256

原创 LeetCode 335. Self Crossing|问题分类分析

算法题目You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] metres to the south, x[3] metres to the east and so o

2016-10-05 11:54:01 297

原创 LeetCode 37. Sudoku Solver|DFS算法

题目简介Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character ‘.’.You may assume that there will be only one unique solution. A sudoku puzzle…题目分析

2016-09-21 00:12:23 309

原创 阿里巴巴面试题|完美洗牌问题

原题概要给定一个降序的正数数组,要求按【最小、最大、次小、次大…】的顺序重新排序。期望的时间复杂度为O(n),空间复杂度为O(1),即不能申请额外数组。 例如:输入【7,6,5,4,3,2,1】    输出【1,7,2,6,3,5,4】思考历程这道题是我在刷知乎的时候看到的,看到题目内容很简单,但在思考的时候却处处碰壁,然后我就打算好好研究这道题,也作为这一次不是leetcode上的算法

2016-09-12 19:48:10 582

原创 Leetcode.174 Dungeon Game |算法解析——动态规划

原题:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p

2016-09-06 19:54:25 2366 3

MFC游戏编程---飞机大战

这是我自己制作的开源代码游戏,全部用MFC写,可以提供新手作为MFC游戏开发的辅助资料。

2016-12-26

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除