- 博客(16)
- 资源 (2)
- 问答 (1)
- 收藏
- 关注
原创 Remove Nth Node From End of List
public class Solution { public ListNode removeNthFromEnd(ListNode head, int n) { if (head == null || n==0) return null; ListNode listNode = new ListNode(0); listNode.next
2015-05-26 23:30:30 239
原创 Integer to Roman
public class Solution { public String intToRoman(int num) { String[][] c= new String[][]{{"0","I","II","III","IV","V","VI","VII","VIII","IX"},{"0","X","XX","XXX","XL","L","LX"
2015-05-24 14:23:07 274
原创 Longest Common Prefix
public class Solution { public String longestCommonPrefix(String[] strs) { if (strs == null) return ""; if (strs.length == 0) return ""; String prefix = strs[0]; if
2015-05-24 14:21:58 281
原创 Container With Most Water
public class Solution { public int maxArea(int[] height) { int max = 0; int left = 0; int right = height.length-1; while (left<right){ max = Math.max(ma
2015-05-19 22:33:00 234
原创 Regular Expression Matching
// 用c/c++代码会简洁并且效率高很多。直接使用c/c++中的字符数组char*做代码会简洁很多 package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/17. */ public class RegularExpressionMatching { public boole
2015-05-17 23:05:39 260
原创 Palindrome Number
package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/13. */ public class PalindromeNumber { public boolean isPalindrome(int x) { if(x<0) return f
2015-05-13 23:01:40 224
原创 Reverse Integer
package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/9. */ public class ReverseInteger { public int reverse(int x) { if(x==-2147483648 || x==2147483647)
2015-05-09 23:44:47 233
原创 ZigZag Conversion
public class Solution { public String convert(String s, int nRows) { int len = s.length(); if (len == 0 || nRows <= 1) return s; String[] ans = new String[nR
2015-05-09 11:52:14 283
原创 Longest Palindromic Substring
package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/7. */ public class LongestPalindromicSubstring { @Test public void test5(){ System.out.println(long
2015-05-07 22:38:10 239
原创 Median of Two Sorted Arrays
package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/4. */ public class MedianOfTwoSortedArrays { // 思路1: 由于时间复杂度限制在O(log(m+n)),只能使用二分法 // 其实这道题可以一般化到求最小的第n位数
2015-05-04 21:32:51 299
原创 Median of Two Sorted Arrays
package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/4. */ public class MedianOfTwoSortedArrays { // 思路1: 由于时间复杂度限制在O(log(m+n)),只能使用二分法 // 其实这道题可以一般化到求最小的第n位数
2015-05-04 21:32:18 256
原创 Longest Substring Without Repeating Characters
package leetcode.xuyi; import org.junit.Test; /** * Created by ethan on 2015/5/4. */ public class LongestSubstringWithoutRepeatingCharacters { // 记下字串的起始位置,当遇到substring中有的字符的时候,起始位置+1 //
2015-05-04 18:24:40 248
原创 Hadoop1.0的分布式安装和安全模式
1.hadoop的分布式安装过程 1.1 分布结构 主节点(1个,是hadoop0):NameNode、JobTracker、SecondaryNameNode 从节点(2个,是hadoop1、hadoop2):DataNode、TaskTracker 1.2 各节点重新产生ssh加密文件 1.3 编辑各个节点的/etc
2015-05-04 15:08:11 297
原创 hadoop1.0的伪分布安装
1.1 设置ip地址 执行命令 service network restart 验证: ifconfig 1.2 关闭防火墙 执行命令 service iptables stop 验证: service iptables status 1.3 关闭防火墙的自动运行 执行命令 chkconfig ipt
2015-05-04 15:03:46 300
原创 Add Two Nums
package leetcode.xuyi; import org.junit.*; /** * Created by ethan on 2015/5/3. */ public class AddTwoNums { // 参考别人代码之后发现 // while (l1 != NULL || l2 != NULL) 这样的思路貌似代码更加简洁了 // 我这种解法代码重
2015-05-03 22:16:46 295
原创 Two Sum
package leetcode.xuyi; import org.junit.*; import java.util.Arrays; import java.util.HashMap; /** * Created by ethan on 2015/5/2. */ public class No1TwoSum { // 思路1 // 直接双重循环必然超时 // 时间
2015-05-02 10:27:21 306
hello.cpp 编译通过,执行时提示:exe文件停止运行
2016-04-04
TA创建的收藏夹 TA关注的收藏夹
TA关注的人