- 博客(34)
- 资源 (4)
- 收藏
- 关注
原创 算法分析与设计丨第十九周丨LeetCode(22)——House Robber(Medium)
题目描述:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac
2018-01-09 22:02:45
282
原创 算法分析与设计丨第十八周丨LeetCode(21)——Binary Tree Maximum Path Sum(Hard)
题目描述:Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connection
2018-01-07 20:35:34
244
原创 算法分析与设计丨第十七周丨算法概论第八章习题——k-spanning tree(8.12)
8.12 The k-SPANNING TREE problem is the following. Input: An undirected graph G = (V,E) Output: Aspanningtreeof G in which each node has degree≤ k, if such a tree exists.
2017-12-28 15:03:36
548
原创 算法分析与设计丨第十六周丨LeetCode(20)——Unique Paths II(Medium)
题目描述:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectivel
2017-12-18 11:08:16
201
原创 算法分析与设计丨第十五周丨LeetCode(19)——Longest Palindromic Substring(Medium)
题目描述: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 a
2017-12-13 21:09:09
231
原创 算法分析与设计丨第十四周丨LeetCode(18)——Maximum Subarray(Medium)
题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the l
2017-12-09 11:27:39
176
原创 算法分析与设计丨第十三周丨LeetCode(17)——Coin Change(Medium)
题目描述:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amoun
2017-12-01 11:52:20
206
原创 编译原理丨第十三周 ——1000. 输入输出LL(1)语法分析程序
Description 输入开始符号,非终结符,终结符,产生式,LL(1)分析表输出LL(1)分析表G[E]:E →E+T | E-T | TT →T*F | T/F | FF →(E) | DD →x | y | z 消除左递归G1[E]: E →TA A →+TA | -TA | e T →FB B →*FB |
2017-11-29 13:24:29
2383
原创 算法分析与设计丨第十一周丨Sicily(15)—— 1003. 最近的0(Hard)
题目描述:输入一个N*M的01矩阵A,对矩阵的每个位置,求至少经过多少步可以到达一个0. 每一步可以往上下左右走一格. 请为下面的Solution类实现解决这一问题的函数nearestZero,函数参数A为给出的01矩阵,A的行数和列数均不大于100. 函数的返回值是问题的答案. class Solution {public: vector> nearestZ
2017-11-19 16:16:09
305
原创 算法分析与设计丨第十周丨LeetCode(14)——Edit distance(Hard)
动态规划题目链接:https://leetcode.com/problems/edit-distance/description/题目描述:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is
2017-11-12 09:10:19
231
原创 算法分析与设计丨第九周丨LeetCode(13)——Redundant Connection(Medium)
并查集算法题目链接:https://leetcode.com/problems/redundant-connection/description/题目描述:In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a grap
2017-10-21 10:52:19
256
原创 算法分析与设计丨第八周丨LeetCode(12)——Friend Circles(Medium)
题目链接:https://leetcode.com/problems/friend-circles/description/题目描述:There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For exam
2017-10-20 19:54:11
257
原创 算法分析与设计丨第七周丨LeetCode(11)——Candy(Hard)
贪心算法题目链接:https://leetcode.com/problems/candy/description/这道题目主要是思路,有了思路便很好办了。之前我始终不太理解贪心算法究竟是什么意思,然后思考一番加做题后发现其实是利用局部的资源最优来判断,比如说这道题目的比左右两边ratings高的candy更多,Kruskal算法的始终取不构成回环的权值最小边,都是贪心算法的体现
2017-10-18 19:40:36
228
原创 编译原理丨第七周 ——1000. 词法分析程序设计 **
Description设一语言的关键词、运算符、分界符的个数与单词如下: struct { int number; string str[10]; } keywords={3,"int","main","return"} ; //关键词struct { int number; string str[10]; } operators ={5,"+","*","=","+=","*="
2017-10-18 16:39:42
3506
原创 算法分析与设计丨第六周丨LeetCode(10)——Best Time to Buy and Sell Stock(Easy)
class Solution {public: int maxProfit(vector& prices) { if(prices.empty()) return 0; int profit = 0; int budget = prices[0];
2017-10-13 19:26:58
335
原创 算法分析与设计丨第六周丨LeetCode(9)——Course Schedule(Medium)
拓扑排序题目链接:https://leetcode.com/problems/course-schedule/description/上周国庆休息,这周继续作业。这题用到了拓扑排序,都是以前数据结构说到的方法,看来得把书拿出来翻一翻了。#include #include#includeusing namespace std;class Solution {
2017-10-10 16:48:11
231
原创 算法分析与设计丨第四周丨LeetCode(8)——Binary Tree Level Order Traversal(Medium)
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas
2017-09-29 17:22:02
267
原创 算法分析与设计丨第四周丨LeetCode(7)——Find Bottom Left Tree Value(Medium)
层次遍历题目链接:https://leetcode.com/problems/find-bottom-left-tree-value/description//** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * Tree
2017-09-27 15:18:35
218
转载 DITHER 抖动算法(转载)
DITHER 抖动算法 对于可用颜色较少的系统,可以以牺牲分辨率为代价,通过颜色值的抖动来增加可用颜色数量。抖动操作是和硬件相关的,OpenGL允许程序员所做的操作就只有打开或关闭抖动操作。实际上,若机器的分辨率已经相当高,激活抖动操作根本就没有任何意义。要激活或取消抖动,可以用glEnable(GL_DITHER)和glDisabl
2017-09-24 16:02:52
21973
2
原创 算法分析与设计丨第三周丨LeetCode(6)——Find Largest Value in Each Tree Row(Medium)
层次遍历&深度遍历/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), ri
2017-09-20 17:46:25
256
原创 算法分析与设计丨第三周丨LeetCode(5)——Median of Two Sorted Arrays(Hard)
分治法题目链接:https://leetcode.com/problems/median-of-two-sorted-arrays/description/本来上个星期就想做这一题的,试一下hard的难度,想了半天,还是只想出一种朴素的方法:用两个标记分别指向两个vector的begin,这样一个个比较下去,直到数到中位数为止。也可以类似这道题目一样:http://blog.csdn.
2017-09-18 20:08:49
366
原创 算法分析与设计丨第二周丨LeetCode(4)——Maximum Subarray(Easy)
动态规划&分治法题目链接:点击打开链接这道题目要求子数组的最大和,用动态规划的方法会优美许多,而分治法的暂时没时间写,下次再补上。动态规划:易想到递推公式:局部最大和:max(curSum+i,i),如果当前子数列之和比遍历到的元素要小,那就取元素为局部最大和 全局最大和:max(maxSum,curSum),将当前全局最大和与局部最大和进行比较代码也可得出
2017-09-14 11:27:18
228
原创 算法分析与设计丨第二周丨LeetCode(3)——Kth Largest Element in an Array(Medium)
class Solution {public: int findKthLargest(vector& nums, int k) { int left = 0,right = nums.size() - 1; while(left < right)//其实类似于快排,但没有用到分治法的思想 { int myleft =
2017-09-13 15:56:43
268
原创 算法分析与设计丨第一周丨LeetCode(2)——Different Ways to Add Parentheses(Medium)
点击打开链接这题目昨天做了今天才有时间写博客。因为这个星期老师讲了分治法所以我就找了这方面的题目,这道题是要处理所有加括号的情况,看了看众多前辈的提示,我用的与其类似的递归的方法,碰到每个符号时将其分为左右两边来处理,遍历一遍字符串,便可处理完毕。class Solution {public: vector diffWaysToCompute(string
2017-09-10 16:22:12
231
原创 算法分析与设计丨第一周丨 LeetCode(1)——Two Sum
太久没打代码了,c++都忘得差不多了。这道题就是作为入门题,对vector进行遍历即可class Solution {public: vector twoSum(vector& nums, int target) { vector my_vec; int num1,num2; int size = nu
2017-09-09 16:24:06
248
原创 3D游戏编程与设计 Week11
这次作业差点就忘记交了,还是蛮简单的。下面开始讲实现步骤。1.初始设置建立一个halo的项目,并设置如下:2.代码部分光圈粒子部分:基础粒子部分public class HaloParticle { 02. public HaloParticle(float r = 0, float a =
2017-05-02 12:32:50
245
原创 3D游戏编程与设计 Week8
这次的作业是跟着这位师兄:@MokHoYin来做的,加上了自己的一些理解,师兄博客地址:http://blog.youkuaiyun.com/qq_33000225/article/details/70045292我就直接贴代码了,不过有点长-_-1.GameEventManager.csusing System.Collections;using System.Collections.
2017-04-16 17:57:43
265
原创 3D游戏编程与设计 Week6
之前因为实训忙成狗没有时间写博客,趁着清明有点小空来写下博客有点懒,就直接贴代码了,这是第一次用代码块来贴代码。后面有效果图SceneContoller.csusing System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespa
2017-04-03 11:20:55
400
原创 3D游戏编程与设计 Week3
这次作业是写太阳系和牧师与魔鬼那个游戏,牧师与魔鬼那个太长了,这星期我就做一下太阳系的吧。写一个程序,实现一个完整的太阳系, 其他星球围绕太阳的转速必须不一样,且不在一个法平面上主要参考的是师兄的博客:http://blog.youkuaiyun.com/simba_scorpio/article/details/508455731.首先先建立好太阳与九大行星,
2017-03-13 14:25:10
494
原创 3D游戏编程与设计 Week2
1.解释对象与资源的区别于联系,根据官方案例,分别总结资源和对象组织的规则/规律。对象一般是一些资源的集合体,是资源整合的具体表现,在游戏中一般为玩家,敌人,环境等,而资源可组成游戏中所有的对象,一般包括声音,脚本,材质等,资源可以被多个对象使用,资源作为模板,可实例化成游戏中具体的对象。 2.编写简单程序代码,逐一验证MonoBehaviour基本行为触发的条件。
2017-03-04 08:13:48
637
原创 Sicily Message Flood
记得之前有一题学习到了用map,对这类题目的确十分管用DescriptionWell, how do you feel about mobile phone? Your answer would probably be something like that “It’s so convenient and benefits people a lot”. However, if yo
2016-12-22 21:39:09
299
原创 文章标题
一点关于炉石的心得15310053 [本人学院](http://sdcs.sysu.edu.cn/)目录一点关于炉石的心得纳克萨玛斯英雄难度老三的通关策略如今天梯环境的一些看法死鱼骑对战心得1.纳克萨玛斯英雄难度老三的通关策略老规矩,先上通关图!naxx1是我唯二通过的英雄冒险模式,也是我第一个开的冒险模式,里面的卡在几个副本里面算是最超模最好用的,通关普通模式后当然会想要挑战英雄模式,今天
2016-09-29 14:52:07
551
vivado license长期可用
2017-04-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人