原创 204. Count Primes
public class Solution { public int countPrimes(int n) { boolean[] notPrime = new boolean[n]; int c
原创 168. Excel Sheet Column Title
class Solution { public String convertToTitle(int n) { Stack<Integer> st=new Stack<>(); w
原创 202. Happy Number
class Solution { public boolean isHappy(int n) { HashSet<Integer> set=new HashSet<>();
原创 200. Number of Islands
class Solution { public int numIslands(char[][] grid) { int m= grid.length; if(m==0) retu
原创 189. Rotate Array
第一種: class Solution { public void rotate(int[] nums, int k) { int [] afternum=new int[nu
原创 INFO org.apache.hadoop.ipc.Client - Retrying connect to server: 0.0.0.0/0.0.0.0:10020.
因爲我的是用windows連接虛擬機進行mapreduce的一些實驗,虛擬機上搭建的hadoop集羣,出現這種問題伴隨的還有無法用虛擬機主機名訪問hadoop網頁都是由於沒有在本地windows的hosts文件 下設置 ip:name
原创 99. Recover Binary Search Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * Tree
原创 100. Same Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * Tree
原创 單鏈表的反轉(包括帶頭節點和不帶頭節點)
帶頭節點 package auguest; class ListNode{ int val; ListNode next; ListNode(int val) { this.val=val; } } public c
原创 96. Unique Binary Search Trees
遞歸:效率比較慢 class Solution { public int numTrees(int n) { int res=0; if(n==0||n==1) return 1; for(int
原创 92. Reverse Linked List II
package auguest; import java.util.Scanner; public class ReverseLinkedListII { public static ListNode reverseBetween
原创 [LeetCode] Restore IP Addresses 復原IP地址
public class Solution { public List<String> restoreIpAddresses(String s) { List<String> res=new Arra
原创 94. Binary Tree Inorder Traversal
遞歸法: package auguest; import java.util.ArrayList; import java.util.List; class TreeNode{ int val; TreeNode left
原创 97. Interleaving String
原文鏈接:https://www.cnblogs.com/grandyang/p/4298664.html class Solution { public boolean isInter
原创 91. Decode Ways
原文鏈接:https://www.cnblogs.com/grandyang/p/4313384.html class Solution { public int numDec