自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 [刷题]Linked List Cycle II

[LintCode]Linked List Cycle II/** * Definition for ListNode. * public class ListNode { * int val; * ListNode next; * ListNode(int val) { * this.val = val; * this

2015-05-31 19:27:19 259

原创 [刷题]Merge k Sorted Lists

[LintCode]Merge k Sorted Lists/** * Definition for ListNode. * public class ListNode { * int val; * ListNode next; * ListNode(int val) { * this.val = val; * this

2015-05-31 19:23:30 315 1

转载 Ubuntu支持GBK编码

Ubuntu默认是不支持GBK编码的。所以首先要先让Ubuntu支持GBK,方法如下:   1.      修改/var/lib/locales/supported.d/local文件,在文件中添加      zh_CN.GBK GBK      zh_CN.GB2312 GB2312   2.      sudo dpkg-reconfigure --force loca

2015-05-27 15:15:25 626

原创 [刷题] Interleaving String

[LintCode]Interleaving Stringpublic class Solution { /** * Determine whether s3 is formed by interleaving of s1 and s2. * @param s1, s2, s3: As description. * @return: true or f

2015-05-26 09:32:36 335

原创 git设置ssh详细教程

git使用https协议,每次pull, push都要输入密码,相当的繁琐。使用git协议,然后使用ssh密钥。这样可以省去每次都输密码。本文以实验室常用的gitlab为例,介绍如何设置。github与之类似,方法通用。大概需要三个步骤:一、本地生成密钥对;二、设置gitlab上的公钥;三、修改git的remote url为git协议。一、生成密钥对。===

2015-05-25 10:37:23 2142

原创 [刷题]Distinct Subsequences

[LintCode]Distinct Subsequencespublic class Solution { /** * @param S, T: Two string. * @return: Count the number of distinct subsequences */ public int numDistinct(String S,

2015-05-24 22:42:31 404

原创 [刷题]Minimum Adjustment Cost

[LintCode]Minimum Adjustment Costpublic class Solution { /** * @param A: An integer array. * @param target: An integer. */ public int MinAdjustmentCost(ArrayList A, int targ

2015-05-23 22:56:28 1096

原创 [刷题]k Sum

[LintCode]k Sumpublic class Solution { /** * @param A: an integer array. * @param k: a positive integer (k <= length(A)) * @param target: a integer * @return an integer

2015-05-23 22:55:33 319

原创 [刷题]Backpack II

[LintCode]Backpack II标准的0-1背包问题。public class Solution { /** * @param m: An integer m denotes the size of a backpack * @param A & V: Given n items with size A[i] and value V[i]

2015-05-21 21:26:10 351 1

原创 [刷题]Backpack

[LintCode]Backpack此题为0-1背包问题的变体。第一版是背包问题的常规思路,方法是可行的,但是会Memory Limit Exceeded。第二版是常规思路的改进版,巧妙地将矩阵的元素类型从int改为boolean,以降低对空间的要求。Version 1 Memory Limit Exceededpublic class Solution {

2015-05-21 20:57:01 447

原创 [刷题]Edit Distance

[LintCode]Edit Distancepublic class Solution { /** * @param word1 & word2: Two string. * @return: The minimum number of steps. */ public int minDistance(String word1, String

2015-05-20 18:01:11 329

原创 [刷题]Longest Common Substring

[LintCode]Longest Common Substringpublic class Solution { /** * @param A, B: Two string. * @return: the length of the longest common substring. */ public int longestCommonSubs

2015-05-19 22:23:59 383

原创 [刷题]Longest Common Subsequence

[LintCode]Longest Common Subsequencepublic class Solution { /** * @param A, B: Two strings. * @return: The length of longest common subsequence of A and B. */ public int l

2015-05-19 22:08:50 315 1

原创 [刷题]Longest Increasing Subsequence

[LintCode]Longest Increasing Subsequence此题并非一道标准的dp。尽管大问题的结果依赖小问题的结果(dp的思路),但该问题的最终输出不是最大的问题的结果,而是所有问题中某一个问题的结果(就本题来看,要求值最大)。这一点值得注意。lis[i]的含义为:以nums[i]为结尾的最大递增子序列的元素个数。本题最后输出为最大递增子序列的元素数,既lis数组中值

2015-05-18 19:15:15 315 1

原创 [刷题]Word Break

[LintCode]Word Breakpublic class Solution { /** * @param s: A string s * @param dict: A dictionary of words dict */ public boolean wordSegmentation(String s, Set dict) {

2015-05-18 18:55:19 265 1

原创 [刷题]Palindrome Partitioning II

[LintCode]Palindrome Partitioning II 这是一道比较复杂的动态规矩题,但不难。复杂是因为它实际上用了两次动态规划,而第二次的目的是降低时间复杂度。不难是因为第一次动态规划其实比较常规。这道题我做了四次,见下,前两次是错的,第三次是对的,但是只用了一次动态规划,时间复杂度是O(n^3),第四次也是对的,用了两次动态规划,时间复杂度是O(n^3)。Ve

2015-05-17 22:55:53 252

原创 [刷题]Jump Game II

[LintCode]Jump Game IIpublic class Solution { /** * @param A: A list of lists of integers * @return: An integer */ public int jump(int[] A) { // 2015-05-15 if

2015-05-15 22:42:28 281 1

原创 [刷题]Jump Game

[LintCode]Jump Gamepublic class Solution { /** * @param A: A list of integers * @return: The boolean answer */ public boolean canJump(int[] A) { // 2015-05-15

2015-05-15 22:42:04 297 1

原创 [刷题]Climbing Stairs

[LintCode]Climbing Stairspublic class Solution { /** * @param n: An integer * @return: An integer */ public int climbStairs(int n) { // 2015-05-14 if (n ==

2015-05-14 22:26:07 290 1

原创 [刷题]Unique Paths II

[LintCode]Unique Paths IIpublic class Solution { /** * @param obstacleGrid: A list of lists of integers * @return: An integer */ public int uniquePathsWithObstacles(int[][]

2015-05-14 11:23:22 250 1

原创 [刷题]Unique Paths

[LintCode]Unique Pathspublic class Solution { /** * @param n, m: positive integer (1 <= n ,m <= 100) * @return an integer */ public int uniquePaths(int m, int n) { //

2015-05-14 09:30:29 274 1

原创 [刷题]Minimum Path Sum

[LintCode]Minimum Path Sumpublic class Solution { /** * @param grid: a list of lists of integers. * @return: An integer, minimizes the sum of all numbers along its path */ pub

2015-05-13 22:16:11 269 1

原创 [刷题]Triangle

[LIntCode]Trianglepublic class Solution { /** * @param triangle: a list of lists of integers. * @return: An integer, minimum path sum. */ public int minimumTotal(ArrayList> tr

2015-05-13 21:45:56 263 1

转载 c/c++中static关键字的作用

在C语言中,static的字面意思很容易把我们导入歧途,其实它的作用有三条。(1)先来介绍它的第一条也是最重要的一条:隐藏。当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性。为理解这句话,我举例来说明。我们要同时编译两个源文件,一个是a.c,另一个是main.c。下面是a.c的内容char a = 'A'; // global variablev

2015-05-10 20:28:20 240

原创 链表findMid方法总结

Version 1 private ListNode findMiddle(ListNode head) { ListNode slow = head, fast = head.next; while (fast != null && fast.next != null) { fast = fast.next.next; // fa

2015-05-08 20:59:52 460

原创 [刷题]Convert Sorted List to Binary Search Tree

[LintCode]Convert Sorted List to Binary Search Tree/** * Definition for ListNode. * public class ListNode { * int val; * ListNode next; * ListNode(int val) { * this.val =

2015-05-08 20:44:35 363 1

原创 firefox常用快捷键

Alt + 数字键 = 打开第N个标签页这种Ctrl + Page Up /Page Down = 激活左边/右边一个标签页Ctrl + Tab = 切换标签页(从左向右)Ctrl + Shift + Tab = 切换标签页(从右向左)Ctrl + Shift + T = 重新载入关闭的标签页Alt + 左箭头 或 Backspace = 转到上一页Alt + 右箭头 或

2015-05-07 19:35:36 452

空空如也

空空如也

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

TA关注的人

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