自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Lnho的专栏

发表是最好的记忆

  • 博客(43)
  • 收藏
  • 关注

原创 Ubuntu常用服务器环境搭建——Nginx+PHP篇

1.安装Nginxapt-get install nginx2.启动Nginxservice nginx start3.访问服务器IP 如果看到“Welcome to nginx!”说明安装好了。 4.安装PHPapt-get install php5-fpm5.配置Nginxvi /etc/nginx/sites-available/default找到下列代码,去掉相应注释location ~

2016-03-31 14:17:15 7798

原创 Ubuntu常用服务器环境搭建——MySQL篇

MySQL1.安装MySQLapt-get updateapt-get install mysql-server2.配置MySQLvi /etc/mysql/my.cnf /** 也可能是/etc/mysql/mysql.conf.d/mysqld.cnf,里面要包含[mysqld]的配置**/在[mysqld] 添加以下项character_set_server=utf8skip-name-

2016-03-31 13:04:39 2933

原创 Leet Code OJ 14. Longest Common Prefix [Difficulty: Easy]

题目: Write a function to find the longest common prefix string amongst an array of strings.翻译: 写一个函数去找到在字符串数组里面的最长的前缀字符串。分析: 首先考虑字符串数组的length为0和为1的情况,为1的情况如果不预先处理,后面判断起来会比较麻烦。然后需要找出这些字符串的最短的长度,超过这个长度

2016-03-25 18:36:12 1534

原创 jedisPool.getResource()方法长时间无响应并且不报错

一个Java Web的系统需要动态根据Redis地址获取数据,截取相关代码如下:获取连接的方法:public static JedisCluster getConn(String host, int port) { String key = getKey(host, port); JedisCluster jedisCluster = (JedisCluster)jedisCon

2016-03-25 14:11:44 9679

原创 Leet Code OJ 125. Valid Palindrome [Difficulty: Easy]

题目: 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

2016-03-25 13:20:39 2928

原创 Leet Code OJ 20. Valid Parentheses [Difficulty: Easy]

题目: Given a string containing just the characters , determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “(]” and “([)]” are not.翻译:

2016-03-24 13:22:19 4907

原创 LeetCode刷题指南(一)

以下是我个人做题过程中的一些体会: 1. LeetCode的题库越来越大,截止到目前,已经有321个问题了。对于大多数人来说,没有时间也没有必要把所有题目都做一遍(时间充裕可以随意)。刷个100题左右应该就差不多了(可以考虑序号为前100多的题目,相对更经典一点)。 2. 从AC率高的开始做,难度从简单->中等,先不要做困难的。 3. 可以按照下文的面试出题频率顺序来做,从频率最高的一批开始。

2016-03-23 15:02:40 116632 11

原创 Leet Code OJ 2. Add Two Numbers [Difficulty: Medium]

题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a

2016-03-23 13:48:25 4339

原创 Leet Code OJ 119. Pascal's Triangle II [Difficulty: Easy]

题目: Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra space?翻译: 给定一个下标k,返回第

2016-03-22 13:54:14 1250 2

原创 Leet Code OJ 118. Pascal's Triangle [Difficulty: Easy]

题目: 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]]翻译: 给定一个数numRows,产生前numRows行的

2016-03-22 11:32:42 1510

原创 Leet Code OJ 8. String to Integer (atoi) [Difficulty: Easy]

题目: 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-03-22 10:43:59 10398 2

原创 Leet Code OJ 338. Counting Bits [Difficulty: Medium]

题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array. Example: For num = 5

2016-03-18 18:32:33 1779

原创 Leet Code OJ 203. Remove Linked List Elements [Difficulty: Easy]

题目: Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5翻译: 从一个整数链表中移除所有value为val的元素。 例如 给定

2016-03-17 23:35:10 1409

原创 Leet Code OJ 107. Binary Tree Level Order Traversal II [Difficulty: Easy]

题目: 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,#,#,15,7},

2016-03-17 20:30:17 1406

原创 Leet Code OJ 88. Merge Sorted Array [Difficulty: Easy]

题目: 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 addit

2016-03-17 13:17:21 2811

原创 Leet Code OJ 110. Balanced Binary Tree [Difficulty: Easy]

题目: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2016-03-16 14:02:13 1711

原创 Leet Code OJ 1. Two Sum [Difficulty: Easy]

题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example: Given nums = [2, 7

2016-03-14 20:33:57 33041 3

原创 Leet Code OJ 191. Number of 1 Bits [Difficulty: Easy]

题目: Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 00000000

2016-03-14 15:05:14 1020

原创 一张大图总结数据结构与算法

数据结构与算法知识结构思维导图: Prim算法:浅谈最小生成树的算法思路(一)Prim算法 Kruskal算法:浅谈最小生成树的算法思路(二)Kruskal算法 快速排序:JDK的快速排序算法实现DualPivotQuicksort

2016-03-09 18:16:31 6528 1

原创 Leet Code OJ 260. Single Number III [Difficulty: Medium]

题目: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums =

2016-03-09 17:50:41 880

原创 MongoDB学习笔记(四)使用Java进行实时监控与数据收集(空间使用量、连接数)

目录: MongoDB学习笔记(一)环境搭建与常用操作 MongoDB学习笔记(二)使用Java操作MongoDB MongoDB学习笔记(三)使用Spring Data操作MongoDB MongoDB学习笔记(四)实时监控与数据收集最近在做一个Java开发的监控系统,里面有一个模块是监控MongoDB的。看到网络上比较少这块资料,特记录如下: 1.下载MongoDB的J

2016-03-08 16:22:09 4982 1

原创 Leet Code OJ 102. Binary Tree Level Order Traversal [Difficulty: Easy]

题目: 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}, return its level order tr

2016-03-08 13:44:19 2201

原创 Leet Code OJ 26. Remove Duplicates from Sorted Array [Difficulty: Easy]

题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with

2016-03-08 13:19:39 1543 2

原创 Leet Code OJ 326. Power of Three [Difficulty: Easy]

题目: Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?翻译: 给定一个整数,写一个函数去判断它是否是3的幂。 更进一步:你能不适用循环或者递归来完成吗?代码:publi

2016-03-07 16:11:32 1040

原创 Leet Code OJ 219. Contains Duplicate II [Difficulty: Easy]

题目: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.翻译: 给

2016-03-07 14:11:58 1132

原创 Leet Code OJ 235. Lowest Common Ancestor of a Binary Search Tree [Difficulty: Easy]

题目: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee

2016-03-07 13:47:14 1120

原创 Leet Code OJ 223. Rectangle Area [Difficulty: Easy]

题目: Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume that the total ar

2016-03-07 13:18:18 1245

原创 Leet Code OJ 172. Factorial Trailing Zeroes [Difficulty: Easy]

题目: Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.翻译: 给定一个整数n,返回n!末尾的0的个数。 提示:你的解决方案应该运行在O(log(n))的时间复杂度。分析: 我们知道要形成一个末

2016-03-07 12:24:54 1214

原创 Leet Code OJ 189. Rotate Array [Difficulty: Easy]

题目: Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note: Try to come up as many solutions as you can,

2016-03-05 23:18:27 1002

原创 Leet Code OJ 328. Odd Even Linked List [Difficulty: Easy]

题目: 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-05 21:52:39 1534

原创 Leet Code OJ 268. Missing Number [Difficulty: Medium]

题目: Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.Note: Your algorithm should run in

2016-03-04 18:16:07 1231

原创 Leet Code OJ 66. Plus One [Difficulty: Easy]

题目: 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.翻译: 给定一个非负数,它是有数字的数组组成,

2016-03-04 16:41:04 1308

原创 Leet Code OJ 58. Length of Last Word [Difficulty: Easy]

题目: 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 defin

2016-03-04 13:53:36 1230

原创 Leet Code OJ 27. Remove Element [Difficulty: Easy]

题目: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn’t matter what you leave beyond the new length.翻译:

2016-03-04 13:40:30 2486

原创 Leet Code OJ 83. Remove Duplicates from Sorted List [Difficulty: Easy]

题目: Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.翻译: 给定一个排序号的链表,删除所有的重复元素,保

2016-03-04 13:15:36 1274

原创 Leet Code OJ 21. Merge Two Sorted Lists [Difficulty: Easy]

题目: 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.翻译: 合并2个已经排序的链表,并且返回一个新的链表。这个新的链表应该由前面提到的2个链表的节点所组成。分析

2016-03-04 13:04:41 3893

原创 Leet Code OJ 206. Reverse Linked List [Difficulty: Easy]

题目: Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both?翻译: 反转一个单链表。分析: 可以先尝试通过简单例子画图分析,来弄清如何修改指向。代码:/** * Definition for

2016-03-03 20:03:06 1181

原创 Leet Code OJ 7. Reverse Integer [Difficulty: Easy]

题目: Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this? Here are some good questions to ask before coding. Bonus points for you if

2016-03-03 16:50:49 929

原创 Leet Code OJ 38. Count and Say [Difficulty: Easy]

题目: 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 “one 2

2016-03-03 13:56:04 714

原创 Leet Code OJ 168. Excel Sheet Column Title [Difficulty: Easy]

题目: Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB 翻译: 给定一个正数,返回它类似Excle中对应的列标题。分析: 实际为10

2016-03-03 13:12:17 1130

空空如也

空空如也

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

TA关注的人

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