自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(63)
  • 资源 (4)
  • 问答 (2)
  • 收藏
  • 关注

原创 最长递增子序列

动态规划法 时间复杂度O(n*n) c++代码实现:int maxLengthIncSub(int nums[],int n){ int length[n] = {0}; int maxLength = 1; for(int i=0;i<n;i++){ length[i] = 1; for(int j

2016-09-17 13:39:27 285

原创 118. Pascal's Triangle

Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]class Solution {public:

2016-09-16 09:22:42 241

原创 31. Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible

2016-09-15 23:51:54 225

原创 59. Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ],

2016-08-22 22:32:33 284

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

2016-08-21 16:46:48 262

原创 Leetcode 202. Happy Number

202. Happy Number QuestionEditorial Solution My SubmissionsTotal Accepted: 84378Total Submissions: 222866Difficulty: EasyWrite an algorithm to determine if a nu

2016-08-20 14:29:13 247

原创 33. Search in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur

2016-04-06 17:58:21 248

原创 215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.

2016-04-06 16:28:32 261

原创 89. Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of

2016-03-31 18:00:31 259

原创 66. Plus One

Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.水题。class Solutio

2016-03-31 17:20:16 229

原创 337. House Robber III

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour

2016-03-30 22:10:27 336

原创 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-03-28 12:45:48 223

原创 67. Add Binary

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".又是一道水题,无非从尾加到头,对长的串特殊处理一下。class Solution {public: string addBinary(stri

2016-03-28 12:24:32 285

原创 102. Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15

2016-03-28 00:10:43 233

原创 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-03-26 14:52:24 258

原创 堆排算法实现

堆排,时间复杂度O(nlogn),空间复杂度O(1)。#include#includeusing namespace std;void sift(int nums[],int low,int high){ int i=low,j=2*i; while (j<=high) { if(j<high&&nums[j]<nums[j+1]) j++; if(nums[i]<n

2016-03-25 22:15:33 379

原创 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-03-25 21:03:52 281

原创 179. Largest Number

Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve

2016-03-25 11:58:46 257

原创 145. Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1]Note: Recursive solu

2016-03-24 10:41:46 213

原创 328. Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in

2016-03-23 17:46:56 205

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

2016-03-21 14:42:38 196

原创 136. Single Number

史上最水的题。。。当然如果用了sort...      Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could

2016-03-20 17:02:05 160

原创 97. Interleaving String

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", ret

2016-03-20 16:22:34 183

原创 160. Intersection of Two Linked Lists

这道题很简单,思路大概是找出最长的那个链表,然后长链表从头开始除掉比短链表长的那一部分,当然不是删掉,移动一下指针就行了,这样下来两个链表就对齐了。之后,一对一的比较,若相同就是交汇处,到遍历完时,没有找到交叉点,那就是空了。/** * Definition for singly-linked list. * struct ListNode { * int val; *

2016-03-18 11:36:57 248

原创 46. Permutations

题目:1~n的全排列思想: 用数组记录操作后的序列,输出结果时只需要输出该数组即可;交换第1个元素与第i(1=当剩余序列中只有一个元素时,得到一种排列结果,输出该结果.#include#include#includeusing namespace std;vector> intVV;void FullArray(vector&nums,int k,int m)

2016-03-16 14:00:43 289

原创 80. Remove Duplicates from Sorted Array II

#include#includeusing namespace std; int removeDuplicates(vector& nums) { int size=nums.size(); if(size==0) return 0; int temp=nums[0]; int count=0; vector::iterator it = nums.begin();

2016-03-15 21:53:13 215

原创 240. Search a 2D Matrix II

此题考查杨氏矩阵的搜索,这里采用的是Step-wise线性搜索解法,其余的方法可参考http://blog.csdn.net/pi9nc/article/details/9082997以下为完整的程序:#include#includeusing namespace std;bool searchMatrix(vector>& matrix, int target) { int ro

2016-03-15 10:51:38 299

原创 76. Minimum Window Substring

class Solution {public: string minWindow(string s, string t) { map tmap,temp; string result; int begin,end; begin=end=0; int count=t.length(); int min=s.length()+1; int finalS

2016-03-12 23:58:17 260

原创 92. Reverse Linked List II

#include#include using namespace std;struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} };ListNode* createList(int a[],int n){ ListNode* head=NU

2016-03-09 15:12:43 199

原创 19. Remove Nth Node From End of List

#include#include using namespace std;struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} };ListNode* createList(int a[],int n){ ListNode* head

2016-03-09 15:11:58 184

原创 231. Power of Two

bool isPowerOfTwo(int n) { if(n<=0) return false; while(n>1) { int r=n%2; if(r!=0) return false; else{ n/=2; } } return true; }

2016-03-09 15:10:56 195

原创 61. Rotate List

ListNode* rotateRight(ListNode* head, int k) { if(head==NULL) return NULL; ListNode* p,*q; int i=0,num=0; p=head; q=head; while(p!=NULL) { num++;

2016-03-09 15:05:00 187

原创 141. Linked List Cycle

bool hasCycle(ListNode *head) { ListNode *p,*q; p=head; q=head; while(q!=NULL&&q->next!=NULL){ p=p->next; q=q->next->next; if(q-p==0) return true; }

2016-03-09 14:32:02 168

原创 sizeof 与 strlen

在一道笔试题中遇到,记录一下。           题目为32位系统上                      char c1[]={'a','b','\0','d','e'};char c2[]="hello"; sizeof(c1),strlen(c1),sizeof(c2),strlen(c2)值分别是 多少?对字符数组,有以下几种定义方法:1) char str[]="

2016-03-05 16:19:32 302

原创 struts与jsp之间的值传递

1.jsp向action                     jsp:                                                 action:                     ServletRequest request=ServletActionContext.getRequest(); Str

2016-01-18 14:37:28 278

原创 解决spring+Mybatis的整合测试问题

第一次使用ssm,参考文章                 http://blog.csdn.net/zhshulin/article/details/37956105#                 http://blog.csdn.net/cool_easy/article/details/42963573                 当单元测试spring与mybatis的

2016-01-10 19:32:35 882

原创 windows下 Qt5的exe打包运行

若要把自己电脑里编译运行得到的exe也能在其他电脑上运行,需要按以下几步做,网上有什么修改配置文件,以期达到静态编译的效果,Qt默认是动态编译,针对Qt5似乎没有必要这样做,只需要把相关的dll文件拷贝到exe所在文件夹里就可以了,不到50M,勉强可以接受,必要的步骤如下:    1.生成release程序      在Qt Creator里把三角形运行按钮上方的debug点击后,选择

2015-06-06 16:31:08 1089 1

原创 qt5中文乱码

当字符串类型是QString时,要正确显示出来中文,可用            QTextCodec *codec = QTextCodec::codecForName("UTF-8");         codec->toUnicode("中文");         这个比较好用,以后暂时用这个吧,,

2015-05-30 15:49:59 273

原创 Python逆序打印正整数

Python逆序打印正整数,递归,不使用全局变量         >>> def reverse(x): str=chr(x%10+ord('0')) if(x>=10): x=(int)(x/10) str+=reverse(x) return str;>>> reverse(123)'321'

2015-05-07 13:12:16 2894

原创 hdu1231

最大子序列和问题,简单dp一下就行了。          #include #include #include #include #include using namespace std; int num[10050]; int sum[10050]; int main() { int k,max,maxi; while(scanf("%d",

2015-04-26 22:26:28 457

QtPropertyBrowser2.6

QtPropertyBrowser2.6,内含Qt打包运行所需dll

2016-04-05

QtPropertyBrowser_2.6 for Qt5.x 属性查看修改器

QtPropertyBrowser_2.6 for Qt5.x 属性查看修改器QtPropertyBrowser_2.6 for Qt5.x 属性查看修改器.前面一哥们10分,我便宜一点,5分吧。 操作细节可参考这个人的文章: http://www.mamicode.com/info-detail-866098.html

2016-03-18

bcprov-jdk15on-152.jar

一.AES 支持密钥128位,192位,256位(常用的是128位 md5, 256位 sha256) 算法/工作模式/填充方式的概念: 算法是:AES 工作模式:ECB/CBC 默认情况下iOS是CBC的,我提供的例子是ECB的的工作模式,所以iOS在设置加密参数的时候要添加参数 kCCOptionECBMode 填充方式:kCCOptionPKCS7Padding iOS似乎只支持这样的填充方式,java有很多填充方式,但是就不支持这个,所以要引用第三方包bouncycastle.

2015-06-08

第5版潘爱民习题答案

其他地方都要3分才能下,我只要1分偶。。计算机网络第5版潘爱民习题答案,是买了那个教程后联系出版社辗转得到的,我并没有使用。

2015-03-29

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

TA关注的人

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