自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 Maximum XOR of Two Numbers in an Array

Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai 31.Find the maximum result of ai XOR aj, where 0 ≤ i, j n.Could you do this in O(n) runtime?Example:Input: [3, 10, 5, 25, 2, 8]

2018-01-11 12:11:42 190

原创 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)).Example 1:nums1 =

2018-01-10 23:02:37 140

原创 8.3证明吝啬SAT问题为NP完全问题

吝啬SAT问题是这样描述的:给定一组子句(每个子句都是其中文字的析取)和整数k,求一个最多有k个变量为true的满足赋值——如果该赋值存在。而我们的目的就是证明吝啬SAT问题为NP完全问题。选择的归约问题为完全SAT问题假设SAT问题有n个变量,则该SAT问题等价于k = n的吝啬SAT问题。这样的归约过程的时间复杂度为O(1),是多项式时间复杂度SAT

2018-01-02 23:30:31 189

原创 Maximal Rectangle

Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1

2017-12-12 23:02:38 156

原创 Largest Rectangle in Histogram

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width o

2017-12-12 22:58:31 172

原创 Edit Distance

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:

2017-12-03 20:39:29 146

原创 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 posi

2017-12-03 20:14:14 143

原创 Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at

2017-12-03 19:57:05 113

原创 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

2017-11-21 22:12:02 128

原创 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

2017-11-21 21:44:16 194

原创 Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1]

2017-11-21 21:33:50 153

原创 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 on

2017-10-18 22:15:29 130

原创 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

2017-10-17 22:38:07 158

原创 Course Schedule

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

2017-10-17 21:30:27 486

原创 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "

2017-09-24 20:48:15 167

原创 Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i

2017-09-17 17:20:03 154

原创 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 sam

2017-09-10 10:38:14 212

原创 Unity3D作业六项目二——射飞碟

这次作业仅仅实现了基本的功能,基本上理解了UFO这次作业就很简单了坑主要在于碰撞器的设置以及一些预设的问题。主要思路就是在发射箭的同时,把CollisionRev : MonoBehaviour 附加上去,当撞击的时候,由他传递参数给CCompent : MonoBehaviour,来改变箭的状态。这次的封装应该是可以的,嘻嘻。using System.Collec

2017-04-05 17:25:51 969

原创 Unity3D作业六项目一——优化打飞碟游戏

这次作业,主要使用了单实例的工厂类,从而可以让各个类之间的访问通过Singleton来进行访问。其次,这次的优化在于将Rule类分开来,把游戏的分数,胜利条件放在Rule类中,从而便于日后管理而涉及到飞碟的颜色等等属性则放在UFO管理之中,从而实现了分离原则。UI没有太多的改动,主要是显示内容和控制发射。这次的场景控制器只有分数,关卡和游戏状态,大大简化了场景控制器所需要知道的东西

2017-04-05 16:59:58 1037

原创 Unity3D作业五项目二

题目:编程实践,请写步骤,贴代码并解释:写个用鼠标打飞碟的游戏。游戏要分多个 round , 飞碟数量每个 round 都是 n 个,但色彩,大小;发射位置,速度,角度,每次发射数量可以变化。游戏过程中,仅能创建 n 个飞碟, 且不容许初始化阶段生成任何飞碟。 飞碟线路计算请使用 mathf 类。 向下加速度 a 是常数。 飞碟被用户击中,则回收。并按你

2017-03-27 19:18:11 821

原创 Unity3D作业五的项目一

题目:写一篇短文,描述以下游戏需求的实现。请写步骤,贴代码并解释:实现点击效果。用 Plane 或其他物体做地面, tag 为“Finish”点击地面后,出现一个圆形攻击标记,两秒后自动消失。注意:该攻击标记不能挡住点击。(Primitive Objects / Cylinder)请使用一个简单工厂创建、管理这些的标记,并自动收回这些标记(注意,这些对象创建

2017-03-27 19:08:03 914

空空如也

空空如也

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

TA关注的人

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