The Dream Of leozp

try my best

Unity 实现NGUI button 按button的判断

Unity 实现NGUI button 按button的判断 using UnityEngine; using UnityEngine.EventSystems; using System.Collections; /// /// 脚本位置:UGUI按钮组件身上 /// 脚...

2016-12-29 09:41:42

阅读数 662

评论数 0

Leetcode: Generate Parentheses

/* dfs回溯 当left>right || left>0 || right>0 时可以减枝 */ class Solution { public: vector generateParenthesis(int n) { vectoranswer; ...

2016-08-31 16:50:00

阅读数 234

评论数 0

Leetcode: Merge Two Sorted Lists

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} ...

2016-08-31 16:44:19

阅读数 153

评论数 0

Leetcode: Remove Nth Node From End of List

/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode* removeNthFrom...

2016-08-31 16:43:18

阅读数 281

评论数 0

Leetcode: 4Sum

class Solution { public: vector> fourSum(vector& nums, int target) { vector >answer; set >ans; int n=nums.si...

2016-08-31 16:41:16

阅读数 179

评论数 0

Leetcode: Letter Combinations of a Phone Number

class Solution { public: map >ans; vectoranswer; vector letterCombinations(string &digits) { answer.clear(); if(di...

2016-08-31 16:39:33

阅读数 146

评论数 0

Leetcode: Roman to Integer

class Solution { public: int romanToInt(string s) { int ret = toNumber(s[0]); for (int i = 1; i < s.length(); i++) { ...

2016-08-31 16:37:56

阅读数 125

评论数 0

Leetcode: Container With Most Water

class Solution { public: /* 贪心: 从长度最长开始,即left=0,right=height.size()-1 每次更新宽度小的那个边界,left向右移动,right向左移动 同步更新答案 即area */ in...

2016-08-31 16:36:44

阅读数 148

评论数 0

Leetcode: Regular Expression Matching

bool isMatch(char* s, char* p) { if(s==NULL || p==NULL){ return false; } if(*p=='\0'){ return *s=='\0'; } if(*(p+1)=='*'){ whi...

2016-08-31 16:35:11

阅读数 167

评论数 0

Leetcode: Palindrome Number

class Solution { public: bool isPalindrome(int x) { int str[30]; int cur=0; if(x<0){ return false; ...

2016-08-31 16:33:31

阅读数 207

评论数 0

Leetcode: Submission Details

class Solution { public: int reverse(int x) { // cout<<x<<endl; long long n=x; if(n<0){ n=-n; } stack...

2016-08-31 16:32:16

阅读数 157

评论数 0

Leetcode: Longest Palindromic Substring

//初始化dp数组 dp[i][j]=(i>=j)?true:false; //状态转移方程 dp[i][j] =(s[i]==s[j])? dp[i+1][j-1] : false; class Solution { public: string longestPalindrome(...

2016-08-31 16:30:22

阅读数 153

评论数 0

Leetcode: Median of Two Sorted Arrays

class Solution { public: double findMedianSortedArrays(vector& nums1, vector& nums2) { int num = nums1.size() + nums2.size(); if (num == ...

2016-08-31 16:27:55

阅读数 131

评论数 0

Leetcode: Longest Substring Without Repeating Characters

int lengthOfLongestSubstring(char* s) { int n=strlen(s); if(n==0){ return 0; } int hash[256]; memset(hash,-1,sizeof(hash)...

2016-08-31 16:24:25

阅读数 137

评论数 0

Leetcode: Add Two Numbers

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} ...

2016-08-31 16:21:59

阅读数 166

评论数 0

Leetcode: Two Sum

class Solution { public: vector twoSum(vector& nums, int target) { vectoranswer; mapQ; for(int i=0;i<nums.size();i++...

2016-08-31 16:20:34

阅读数 119

评论数 0

关于俩个string 是否相等

通过String s1=new String("abc")和String s2="abc",则s1==s2为true。 s1利用new 操作后,为该对象在堆(Heap)区分配了一块内存; s2是字符串常量,存放在内存的”文字常量区“ ;虽然两个对象的值...

2016-08-29 20:59:51

阅读数 322

评论数 0

字符表示法

以下选项中非法的C语言字符常量是? 正确答案: D   你的答案: A (错误) '\007' '\b' 'a' '\09' 本题考查字符常量,字符常量是用单引号括起来的一个字符。例如:'a'、'='、'+'等。转义字符是一种特殊的字符常量。转义字符以反斜线"\"...

2016-08-29 20:58:02

阅读数 310

评论数 0

堆排序

class HeapSort { public: void MaxHeapFixup(int a[], int i){ int j, temp; temp = a[i]; j = (i - 1) / 2; while (j >= 0 && i != 0){ //往上...

2016-08-28 23:15:50

阅读数 216

评论数 0

计数排序

class CountingSort { public: int * countingSort(int* A, int n) { // write code here int min_ = A[0]; int max_ = A[0]; for (int i = 0; i<n...

2016-08-28 14:15:42

阅读数 237

评论数 0

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