自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

hello congshen

自我成长

  • 博客(41)
  • 资源 (1)
  • 收藏
  • 关注

原创 [unity] unity学习——弹球游戏

一、学习内容通过弹球游戏,来熟悉unity的简单操作,以及一些脚本的添加及控制。弹球游戏:  即只有一个底盘和一个球,控制底盘去接球,球撞到底盘后随机一个角度反弹。没接住球就算结束。二、弹球游戏的制作1、打开unity5,新建一个3d工程。2、在Hierarchy视图框中添加一个cube对象,并命名Plate,作为底盘:这个对象的Inspector视图的Transfor

2016-06-30 22:48:34 12303 2

原创 [leetcode] 【查找】 74. Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2016-06-21 15:07:01 255

原创 [leetcode] 【查找】 35. Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.

2016-06-21 11:24:32 239

原创 [leetcode] 【查找】 34. Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found

2016-06-21 09:33:42 228

原创 [leetcode] 【分治法】 69. Sqrt(x)

Implement int sqrt(int x).Compute and return the square root of x.题意实现平方根函数,返回x的根。题解二分法,取到合适的数为止。class Solution {public: int mySqrt(int x) { if(x<2) return x; double

2016-06-21 00:39:50 390

原创 [leetcode] 【分治法】 50. Pow(x, n)

Implement pow(x, n).题意实现幂函数。题解使用分治法求解。分:将n分成n/2  直到n=0时,返回1;治:对n为偶数,返回两数相乘的结果,奇数再乘多一个x; class Solution {public: double myPow(double x, int n) { if(n<0) return 1/power(x,-n

2016-06-21 00:37:26 562

原创 [leetcode] 【排序】 75. Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers

2016-06-20 19:00:36 232

原创 [leetcode] 【排序】 41. First Missing Positive

Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant

2016-06-20 18:12:18 240

原创 [leetcode] 【排序】 148. Sort List

Sort a linked list in O(n log n) time using constant space complexity.题意对链表进行排序,时间复杂度O(n log n),空间复杂度为常数。题解可

2016-06-20 13:20:20 199

原创 [leetcode] 【排序】 147. Insertion Sort List

Sort a linked list using insertion sort.题意用插入排序算法为链表排序。题解遍历原链表的每个元素,每个元素都有在新链表中从头往后找适合其的位置,然后插入。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode

2016-06-20 13:00:07 234

原创 [leetcode] 【排序】 23. Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题意合并k个排好序的链表,并返回这个排好序的链表。题解两个两个合并,即复用[leetcode] 【排序】 21. Merge Two Sorted Lists这题的函数。/**

2016-06-20 12:46:13 250

原创 [leetcode] 【排序】 21. Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.题意合并两个链表,新的链表由两个链表的节点组成。题解和归并类似,一步步取两条链最小那个节点即可。

2016-06-20 12:11:19 246

原创 [leetcode] 【排序】 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold add

2016-06-20 11:56:10 194

原创 [leetcode] 【栈】150. Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1"

2016-06-16 18:54:18 189

原创 [leetcode] 【栈】 84. 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

2016-06-16 16:48:59 189

原创 [leetcode] 【栈】 32. Longest Valid Parentheses

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",

2016-06-16 16:08:25 253

原创 [leetcode] 【栈】 20. Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va

2016-06-16 15:56:00 192

原创 [leetcode] 【字符串】58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2016-06-15 22:07:57 220

原创 [leetcode] 【字符串】71. Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case where p

2016-06-15 16:50:47 210

原创 [leetcode] 【字符串】 49. Group Anagrams

Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: Al

2016-06-15 16:47:55 298

原创 [leetcode] 【字符串】 38. Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as 

2016-06-15 15:53:46 247

原创 [leetcode] 【字符串】13. Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题意把罗马数字转变为int型数据题解转变的规则      ://Ⅰ(1)Ⅴ(5)Ⅹ(10)L(50)C(100)D(500)M(1000) 

2016-06-15 15:38:46 203

原创 [leetcode] 【字符串】 12. Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题意把int型数据转换为罗马数字。题解根据罗马的转换制度由高到低转换即可      const int radix[] =

2016-06-15 15:08:35 228

原创 [leetcode] 【字符串】 65. Valid Number

Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo

2016-06-15 11:35:40 255

原创 [leetcode] 【字符串】 14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.题意找字符串数组里的最长公共前缀。题解解法很多,第一个是横向匹配,第一组与每一组对比,每比一次取最小公共前缀。匹配完则得到所有公共前缀。能通过,但是比较慢class Solution {public:

2016-06-15 11:10:32 205

原创 [leetcode[ 【字符串】 44. Wildcard Matching

Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t

2016-06-14 23:59:19 215

原创 [leetcode] 【字符串】 10. Regular Expression Matching

Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input st

2016-06-14 22:30:14 164

原创 [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, and there exists one unique longest palindromic substring.题意找S中的最长回文子串,回

2016-06-13 11:27:01 172

原创 [leetcode] 【字符串】 67. Add Binary

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".题意两个字符串表示两个二进制数,返回二进制的字符串表示他们的和。题解我是先翻转再操作,这样可以从下标0开始操作。注意长度,以及最后进位。

2016-06-13 11:00:30 220

原创 [leetcoide] 【字符串】8. String to Integer (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2016-06-13 10:43:51 176

原创 [leetcoide] 【字符串】28. Implement strStr()

Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题意两个字符串haystack和needle ,如果needle是haystack的子串,返回needle在haystack

2016-06-12 10:25:41 209

原创 [leetcoide] 【字符串】125. Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a

2016-06-11 17:23:31 198

原创 [leetcode] 【链表】 146. LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if

2016-06-03 21:18:23 278

原创 [leetcode] 【链表】143. Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it t

2016-06-03 16:09:31 289

原创 [leetcode] 【链表】142. Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?

2016-06-02 16:13:25 272

原创 [leetcode] 【链表】141. Linked List Cycle

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题意 判断一个链表是否是循环链表。题解 射两个指针,一快一慢,如果快的套了慢的一圈,那么就是循环的,快的到了尾,那么就是不循环的。

2016-06-02 16:05:49 224

原创 [leetcode] 【链表】 138. Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.题意 一个链表包含额外的随机指针,这个指针指向任意节

2016-06-02 10:33:00 188

原创 [leetcode] 【链表】25. Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is

2016-06-02 00:31:21 201

原创 [leetcode] 【链表】24. Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y

2016-06-01 22:01:05 201

原创 [leetcode] 【链表】19. Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the

2016-06-01 16:56:47 280 1

java中文api

中文版java API,不谢

2016-03-25

空空如也

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

TA关注的人

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