自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(71)
  • 资源 (1)
  • 收藏
  • 关注

原创 Leetcode 第 120 场周赛----在二叉树中分配硬币

给定一个有 N 个结点的二叉树的根结点 root,树中的每个结点上都对应有 node.val 枚硬币,并且总共有 N 枚硬币。在一次移动中,我们可以选择两个相邻的结点,然后将一枚硬币从其中一个结点移动到另一个结点。(移动可以是从父结点到子结点,或者从子结点移动到父结点。)。返回使每个结点上只有一枚硬币所需的移动次数。原题链接:在二叉树中分配硬币 解题思路:小白为了练手,...

2019-01-20 16:50:06 335

原创 我要开始我的shader辣

首先分享几个学习shader的网站:shadertoy学习分享网站:https://www.shadertoy.com/shader大牛网站:http://www.iquilezles.org/www/index.htm还有几篇引导入门的博客:https://gamedevelopment.tutsplus.com/tutorials/a-beginners-guide-to-co...

2018-08-16 22:50:26 177

原创 Linux共享文件夹的方法

被作了那么多次,千百种方法,这种对我最简单最有效,写下来1、完成windows上的共享文件夹权限开放给everyone的设置2、打开linux虚拟机,选择设置,点击添加新的挂载点3、选择在windows上前面设置的共享文件夹的路径,并且命名好其在当下Linux系统下的代名4、打开linux的终端,首先创建一个挂载的目录mkdir /mnt/Windows_Share3/5、设置挂载输入如下命令:m...

2018-06-11 15:42:57 13601

原创 论文Stack Hourglass实战环境配置教程(装了两天的我决定分享一下)

环境要求:Torch7hdf5 (and the torch-hdf5 package,这个包其实在Torch7安装的时候就安装了,不用管,只需要下载hdf5)cudnnqlua (for displaying results)安装cuda,因为安装cudnn前需要安装cuda: cuda安装教程   (注意一定要先确保虚拟机的磁盘分区空间足够,这个文件1.9G呢!光下载就1.9G,后面安装也需要...

2018-04-07 12:40:23 629

原创 算法设计期末作业-08-8.22

题目 ##(题目比较长,找了一个中文版的贴在下面)在任务调度,常常会用到图。其中节点应用于任务,任务i到j的有向边表示i是j的先期条件。这样的图描述了调度问题中的任务先后关系(约束) 。显然,一个调度是可行的当且仅当该图无环;如果调度不可行,我们需要使其无环所需的最小约束数量。 给定一个有向图G =(V,E),子集E’⊆E称为一个反馈弧集,反馈弧集是指将其移除后,将使得G无环。 反馈弧集(FAS

2017-07-14 23:17:55 320

原创 算法设计期末作业-08-8.22

题目 ##(题目比较长,找了一个中文版的贴在下面)在任务调度,常常会用到图。其中节点应用于任务,任务i到j的有向边表示i是j的先期条件。这样的图描述了调度问题中的任务先后关系(约束) 。显然,一个调度是可行的当且仅当该图无环;如果调度不可行,我们需要使其无环所需的最小约束数量。 给定一个有向图G =(V,E),子集E’⊆E称为一个反馈弧集,反馈弧集是指将其移除后,将使得G无环。 反馈弧集(FAS

2017-07-14 23:17:38 507

原创 算法设计期末作业07-8.16

题目有点长久去网上截了一个一小段的题目题目菜谱和3SAT问题 Input: n, the number of ingredients to choose from: D,the n*n “discord” matrix; some number p >= 0 Output: The maximum number of ingredients we can choose with penalty

2017-07-13 17:59:37 353

原创 算法设计期末作业-06-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 deletion leaves

2017-07-13 17:12:22 431

原创 算法设计期末作业05-8.14

题目Prove that the following problem is NP-complete: given an undirected graph G = (V, E) and an integer k, return a clique of size k as weill as an independent set of size k, provided both exist.问题解答这个问

2017-07-13 16:44:55 353

原创 算法设计期末作业04-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,

2017-07-13 16:26:50 310

原创 算法设计期末作业03-8.10

题目Proving NP-completeness by generalization. For each of the problems below, prove that it is NP-complete by showing that it is a generalization of some NP-complete problem we have seen in this chapter

2017-07-11 17:18:56 445

原创 算法设计期末作业02-8.8

题目:In theEXACT4SATproblem, the input is a set of clauses, each of which is a disjunction of exactly four literals, and such that each variable occurs at most once in each clause. The goal is to find

2017-07-11 15:57:47 264

原创 算法设计期末作业01-8.3

题目STINGY SAT is the following problem: given a set of clauses(each a disjunction of literals) ans an integer k, find a satisfying assignment in which at most k variables are true, if such an assignment

2017-07-11 15:56:27 314

原创 199. Binary Tree Right Side View

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, 1

2017-06-28 21:01:53 164

原创 452. Minimum Number of Arrows to Burst Balloons

There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it’s horizontal, y-coordina

2017-06-28 17:39:18 223

原创 455. Assign Cookies

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cook

2017-06-28 16:59:27 194

原创 547. Friend Circles

There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, then A

2017-06-28 15:52:38 172

原创 104. Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 采用递归的算法,同时每次只要为比较大的一边+1就好了。 代码如下:/** *

2017-06-28 15:04:09 166

原创 108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.这道题用dfs去做。代码如下: 注意TreeNode *root=new TreeNode(nums[mid])往root中加数 代码如下: /** * Definition for a b

2017-06-28 14:48:44 173

原创 486. Predict the Winner

Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a

2017-06-23 16:27:35 178

原创 516. Longest Palindromic Subsequence

Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the maximum length of s is 1000.Example 1: Input:“bbbab” Output: 4 One possible longest palindromic sub

2017-06-23 15:25:51 155

原创 63. Unique Paths II

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 respectively in the grid.For ex

2017-06-22 13:34:16 154

原创 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the botto

2017-06-22 12:31:19 133

原创 303. Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example: Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1 sumRange(2, 5) -> -1 sumRange(0, 5

2017-06-22 12:11:22 135

原创 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive inte

2017-06-21 09:43:44 137

原创 121. Best Time to Buy and Sell Stock

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

2017-06-21 09:36:32 174

原创 198. House Robber

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 adjacent houses

2017-06-19 15:57:04 163

原创 101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric:1/ \ 2 2 / \ / \ 3 4 4 3 But the fol

2017-06-11 09:27:36 151

原创 107. Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example: Given binary tree [3,9,20,null,null,15,7],

2017-06-11 09:16:31 166

原创 110. Balanced Binary Tree

Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by

2017-06-10 12:04:50 130

原创 Add to List 111. Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Subscribe to see which companies asked this

2017-06-10 11:45:14 160

原创 112. Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tree and sum = 2

2017-06-10 11:25:20 178

原创 Add to List 257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree:1 / \ 2 3 \ 5 All root-to-leaf paths are:[“1->2->5”, “1->3”] 这道题是利用DFS算法的思路。先从root出发,然后递归

2017-06-10 10:58:34 147

原创 437. Path Sum III

You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it must go

2017-06-04 11:33:37 191

原创 543. Diameter of Binary Tree

Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may no

2017-06-04 11:15:25 157

原创 Add to List 563. Binary Tree Tilt

Given a binary tree, return the tilt of the whole tree.The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree nod

2017-06-04 10:54:23 492

原创 572. Subtree of Another Tree

Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node’

2017-06-03 22:06:58 169

原创 524. Longest Word in Dictionary through Deleting

Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, return

2017-05-29 16:46:05 241

原创 349. Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].这道题也是先排序后比较大小的方法,同时这里运用set来避免重复的问题。 这里注意set的用法。还有set的insert函数,迭代器的用法也要

2017-05-29 16:28:57 180

原创 350. Intersection of Two Arrays II

Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].这道题其实就是先排序后一个个比较的方法。代码如下:class Solution {public: vector<int> in

2017-05-29 16:20:09 152

SHA加密算法

SHA加密解密系统学习!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2018-01-06

空空如也

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

TA关注的人

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