- 博客(206)
- 资源 (16)
- 收藏
- 关注
原创 一定要做的事(备忘)
一:玩树莓派(Raspberry Pi):二:用firefox OS或者ubuntu的手机至于ubuntu的电脑,已经用上一段时间了。准备彻底放弃windows,拥抱开源目前的手机是个低配的windows phone
2015-02-01 12:49:24 587
原创 struts2+hibernate留言板 练习java ee
**action:**准备数据,跳转到主界面 GoMessageUi.javapackage com.frank.action;import java.util.List;import org.apache.struts2.ServletActionContext;import com.frank.domain.Message; import com.frank.domain.User;
2015-04-03 16:32:46 2561 1
原创 No result defined for action com.frank.action.RegistAction and result success
为action添加上命名空间即可<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> namespace="/"> /index.jsp
2015-03-19 16:47:53 970
转载 eclipse快捷键
Ctrl+1 快速修复(最经典的快捷键,就不用多说了)Ctrl+D: 删除当前行 Ctrl+Alt+↓ 复制当前行到下一行(复制增加)Ctrl+Alt+↑ 复制当前行到上一行(复制增加)Alt+↓ 当前行和下面一行交互位置(特别实用,可以省去先剪切,再粘贴了)Alt+↑ 当前行和上面一行交互位置(同上)Alt+← 前一个编辑的页面Alt+→ 下一个编辑的页面(当然是针对
2015-03-12 22:44:20 691
原创 预言~~~~
10年后计算机不会再需要硬盘,所以,开机速度也会大大提升,达到5s内开机。同时U盘也会被淘汰。不会存在任何客户端软件,所有应用均以B/S模式开发。应用不再会出现移植性问题。使用电脑完成的一切工作将在浏览器中完成。对网络的依赖越来越严重,网速至少【必须】达到100M甚至更高,否则,根本无法支撑计算机对网络的需求。而且,每一个有计算机的地方必须要有网络。以linux内核开发的操作系统会
2015-03-04 23:56:37 617
原创 LeetCode Remove Element
链接:https://oj.leetcode.com/problems/remove-element/跟上一道题很像,设置两个指针根据情况交替前进就可以。代码很简单class Solution{ public: int removeElement(int A[],int n,int elem){ int p1=-1,p2=0; while(p2<n){
2015-02-26 14:00:50 496
原创 LeetCode Remove Duplicates from Sorted Array
链接:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/把有序数组中重复的元素删除,并返回删除后的数组长度。考虑直接插入排序的过程,如果遇见重复的元素,直接抛弃,判断下一个元素。由于数组本身有序,所以,时间复杂的为O(n).class Solution{ public:
2015-02-23 23:42:37 467
原创 LeetCode Generate Parentheses
链接:https://oj.leetcode.com/problems/generate-parentheses/好几天没做题了,一直在看java ee。。看来我在回溯,递归方面还是相当的弱啊。。。最后还是参考的别人的思路class Solution{ public: vector generateParenthesis(int n) { vect
2015-02-20 19:43:37 497
原创 LeetCode Valid Parentheses
链接: https://oj.leetcode.com/problems/valid-parentheses/括号匹配。用栈class Solution{ public: bool isValid(string s) { stack sta; int n=s.size(); for(int i=0;i<n;i++) { char t=s[
2015-02-14 17:01:36 575
原创 jsp入门案例 用户管理系统 mvc模式
工程结构如下,其中,图上少了main.jsp界面。该界面为主界面,提供跳转到增,删,查,改,界面的超链接 部分功能未实现开发环境如下:ubuntu 14.04 +myeclipse 2014 +tomcat 7+mysql+jdbc5.1.7参考传智博客 韩顺平java ee教程。数据库如下:-- MySQL dump 10.13 Distrib 5.5.41,
2015-02-13 22:58:44 7186
转载 Mysql中自增字段(AUTO_INCREMENT)的一些常识
原文链接: http://naxieshir.com/fenlei/2/p/151.html在系统开发过程中,我们经常要用到唯一编号。使用过mysql的人都应该知道,mysql有一个定义列为自增的属性:AUTO_INCREMENT。指定了AUTO_INCREMENT的列必须要建索引,不然会报错,索引可以为主键索引,当然也可以为非主键索引。(不一定要做主键
2015-02-13 18:54:57 1343
原创 LeetCode Remove Nth Node From End of List
链接: https://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/给链表添加哨兵,使用差速指针找到待删除节点的上一个节点,删除即可 。只需遍历一次链表/** * Definition for singly-linked list. * struct ListNode { * int va
2015-02-12 00:58:46 482
原创 LeetCode 4sum
链接:https://oj.leetcode.com/problems/4sum/一种方法是跟3sum一样,使用头尾指针交替移动,时间复杂度为O(n3),空间复杂度为O(1),注意去重class Solution{ public: vector >fourSum(vector &num,int target) { vector > ans; sort(n
2015-02-10 00:19:42 507
原创 我不是会学会玩
我是笨鸟先飞。你们只看到我白天玩的时候,却没看到我因为一道题想到第二天天亮的时候。不是我接受能力强,是我在假期的时候已经把下学期的课已经学完。我也因为一个小问题一连几天都解决不了过,但最终都是通过不断地搜索资料,尝试,学习,解决。而不是伸手要答案。你们在看电视剧,电影的时候,我在看书,看教学视频,或者是读别人的博客。不断地接触新事物,尝试以前没有尝试过的东西,所以,我编码比你们
2015-02-09 00:44:38 722
原创 LeetCode Letter Combinations of a Phone Number
链接:https://oj.leetcode.com/problems/letter-combinations-of-a-phone-number/递归算法:class Solution{ public: vector<string> letterCombinations(string digits) { vector<string>
2015-02-06 01:37:29 651
原创 LeetCode 3Sum Closest
链接:https://oj.leetcode.com/problems/3sum-closest/跟3-sum的思路是一样的。根据sum与target的大小关系,分别移动数组两端的“指针”,同时记录sum与target最小的距离class Solution {public: int threeSumClosest(vector &num,int target)
2015-02-02 22:33:20 459
原创 LeetCode Integer to Roman
链接: https://oj.leetcode.com/problems/integer-to-roman/题目上已经说最大出现的整型值为3999,这样就很简单了。class Solution{ public: string intToRoman(int num) { string ans; char str_num[8]; sprintf(str_n
2015-01-31 20:42:25 383
原创 Container With Most Water
链接: https://oj.leetcode.com/problems/container-with-most-water/尺取法,从两端向中间缩进class Solution{ public: int maxArea(vector &height) //尺取法 { int L=0; int R=height.size()-1; int a
2015-01-29 15:02:53 388
原创 LeetCode ZigZag Conversion
链接: https://oj.leetcode.com/problems/zigzag-conversion/题意为:把字符串按如下规则排列A G MB FH LNCE IK :D J :输出按行顺序
2015-01-28 01:34:23 457
原创 LeetCode 5 最长回文子串 Manacher线性算法
题目链接:https://oj.leetcode.com/problems/longest-palindromic-substring/回文串即正向反向序列都一样的连续序列 如abba,abcba...为了统一回文串的偶数情况和奇数情况,可以向串中插入不相关的字符,例如abba->#a#b#b#a#, abcba->#a#b#c#b#a#建立数组arr[]记录主串中以第
2015-01-26 12:19:47 647
原创 LeetCode Longest Substring Without Repeating Characters
链接: https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/字符串中最长连续不重复子序列,用JAVA中的哈希表比较方便public class Solution { public int lengthOfLongestSubstring(String s) {
2015-01-22 23:50:34 455
原创 Add Two Numbers
链接:https://oj.leetcode.com/problems/add-two-numbers/链表的大数加法/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) :
2015-01-20 20:08:30 409
原创 vim 常用插件的安装
安装如下几个插件taglist 以分割窗口显示代码结构预览 下载地址:http://www.vim.org/scripts/script.php?script_id=273stl STL语法高亮 下载地址:http://www.vim.org/scripts/script.php?script_id=2224autocomplpop 语法自动补全 下载地址: h
2015-01-20 14:48:57 483
原创 LeetCode Swap Nodes in Pairs
链接:https://oj.leetcode.com/problems/swap-nodes-in-pairs/交换链表相邻的节点的位置/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int
2015-01-18 14:24:10 372
原创 LeetCode Majority Element
链接: https://oj.leetcode.com/problems/majority-element/LeetCode给的这道题的解答真的不错:Runtime: O(n2) — Brute force solution: Check each element if it is the majority element.Runtime: O(n), Space: O(n) —
2015-01-16 20:02:16 422
翻译 10 Open Source Security Tools from Google, Facebook, Netflix and Cisco
原文地址:http://www.linux.com/news/software/applications/797378-10-open-source-security-software-tools源自Google,Facebook,Netflix和Cisco的十个开源安全工具Choice has long been a defining feature of the wor
2015-01-11 15:49:52 837
原创 JAVA基础课程设计 简易坦克大战
工程的结构如下:类名父类/接口功能Palyvoid音频播放Wel_PanelJPanel欢迎界面keylistenerKeyAdapter键盘监听PC_tankRunnable
2015-01-09 20:00:41 2242
原创 JAVA基础课程设计 简易扫雷
以下每行代码,文字均为原创,转载请注明出处.程序一共分为7个文件,每个文件为一个类文件名功能描述Test.java测试类,包含main()函数Mine.java设计主界面,Calmine.java随机雷的位置.计算雷区点击后应该显示的数字My_button.java继承自button类,添加按钮的坐标x,y
2015-01-03 17:00:43 10488 3
原创 LeetCode Evaluate Reverse Polish Notation
链接: https://oj.leetcode.com/problems/evaluate-reverse-polish-notation/后缀表达式求值class Solution{ public: int evalRPN(vector &tokens) { stack stk; int ans=0; for(int i=0;i<tokens.siz
2015-01-01 10:47:33 376
原创 LeetCode Maximum Product Subarray
链接: https://oj.leetcode.com/problems/maximum-product-subarray/求最大连续序列的乘积因为偶数个负数相乘为正数,且任何数乘0等于0.所以在计算的过程中需要维护两个数组,一个记录到当前位的最大乘积,一个记录到当前位的最小乘积..并初始化为A[i]class Solution{ public: int maxPr
2014-12-27 14:03:35 447
原创 LeetCode Merge Two Sorted Lists
链接: https://oj.leetcode.com/problems/merge-two-sorted-lists/题目要去把两个有序的链表合并,并且合并后的链表依然有序./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; *
2014-12-24 22:31:29 352
原创 LeetCode Single Number II
链接: https://oj.leetcode.com/problems/single-number-ii/虽然知道这个题肯定跟位运算,异或有关...但实在没想出来怎么解决class Solution {public: int singleNumber(int A[], int n) { int l=0,r=1; sort(A,A+n);
2014-12-14 16:41:47 369
原创 LeetCode Find Peak Element
链接: https://oj.leetcode.com/problems/find-peak-element/题目要求复杂度在对数级以内对数组下标进行二分搜索,public class Solution{ public int findPeakElement(int [] num) { int l=0,r=num.length-1; int mid=(l+r)/2
2014-12-13 20:02:28 498
原创 LeetCode Minimum Path Sum
链接: https://oj.leetcode.com/problems/minimum-path-sum/简单的动态规划.[i][j]表示到达位置(i,j)时的最小sumpublic class Solution{ public int minPathSum(int[][] grid) { int n=grid.length; int m=grid[0
2014-12-13 12:32:41 388
原创 LeetCode 3sum
链接: https://oj.leetcode.com/problems/3sum/2sum:尺取法 通过a+b于tar3sum:即对0~n个数分别做2sum...
2014-12-12 17:13:32 392
原创 LeetCode Best Time to Buy and Sell Stock II
链接: https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/class Solution{ public: int maxProfit(vector &prices) { if(prices.size()==0) return 0; int ans=0; for(i
2014-12-10 14:07:12 331
原创 LeetCode Permutations
链接: https://oj.leetcode.com/problems/permutations/每次从num中选择一个数添加到结果中,并用used标记用过的数.public class Solution { private boolean used[]; private List > ans; private List tans ; public List > p
2014-12-08 22:08:58 427
原创 LeetCode Rotate List
链接: https://oj.leetcode.com/problems/rotate-list//** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * va
2014-12-05 21:39:24 385
原创 LeetCode Reorder List
链接: https://oj.leetcode.com/problems/reorder-list/空间复杂度为O(n),时间复杂度为 O(n)的代码:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * Lis
2014-12-04 13:55:13 317
bcloud_3.6.1-1_all.deb
2015-02-08
《汇编语言》王爽
2012-08-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人