Java
飞奔的六六
这个作者很懒,什么都没留下…
展开
-
Java技术栈(2017年底总结)——思维导图
原创 2018-08-01 23:45:25 · 3359 阅读 · 0 评论 -
【leetcode】985. Sum of Even Numbers After Queries
class Solution { public int[] sumEvenAfterQueries(int[] A, int[][] queries) { int[] result = new int[A.length]; for(int j=0; j<A.length; j++) { int[] query...原创 2019-05-02 13:52:35 · 235 阅读 · 0 评论 -
【leetcode】908. Smallest Range I
class Solution { public int smallestRangeI(int[] A, int K) { int min = A[0]; int max = A[0]; for(int a : A) { min = Math.min(min,a); ma...原创 2019-05-02 14:16:59 · 145 阅读 · 0 评论 -
【leetcode】509. Fibonacci Number
斐波那契数列(限制30位)递归解法class Solution { public int fib(int N) { if(N==0) return 0; if(N==1) return 1; return fib(N-1)+fib(N-2); }}自底向上DP...原创 2019-04-23 14:38:07 · 193 阅读 · 0 评论 -
【leetcode】897. Increasing Order Search Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { Tre...原创 2019-05-02 15:05:15 · 188 阅读 · 0 评论 -
【leetcode】867. Transpose Matrix
class Solution { public int[][] transpose(int[][] A) { int row = A.length; int column = A[0].length; int[][] B = new int[column][row]; for(int i=0; i<r...原创 2019-05-02 15:27:40 · 157 阅读 · 0 评论 -
【leetcode】1002. Find Common Characters
class Solution { public List<String> commonChars(String[] A) { List<String> dups = new ArrayList(); int length = A[0].length(); for(int i=0; i<length; i+...原创 2019-04-24 10:30:36 · 288 阅读 · 0 评论 -
【leetcode】883. Projection Area of 3D Shapes
class Solution { public int projectionArea(int[][] grid) { int count = 0; for (int i=0,v=0; i<grid.length; i++, count+=v, v=0) { for (int j=0; j<grid[i].len...原创 2019-04-24 11:02:59 · 184 阅读 · 0 评论 -
【leetcode】559. Maximum Depth of N-ary Tree
/*// Definition for a Node.class Node { public int val; public List<Node> children; public Node() {} public Node(int _val,List<Node> _children) { val = _val...原创 2019-04-24 11:52:47 · 265 阅读 · 0 评论 -
【leetcode】811. Subdomain Visit Count
class Solution { public List<String> subdomainVisits(String[] cpdomains) { List<String> result = new ArrayList(); Map<String,Integer> domainMap = new Hash...原创 2019-05-02 13:38:46 · 166 阅读 · 0 评论 -
【leetcode】938. Range Sum of BST
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { ...原创 2019-05-02 12:07:27 · 157 阅读 · 0 评论 -
【leetcode】999. Available Captures for Rook
class Solution { public int numRookCaptures(char[][] board) { int row = 0; int column = 0; boolean hasFound = false; for (int i=0; i<8; i++) { ...原创 2019-04-23 10:41:26 · 480 阅读 · 0 评论 -
【Java】Java锁的分类——思维导图
原创 2019-03-04 11:44:19 · 731 阅读 · 0 评论 -
【Java】Java名词解释
JavaEE:Java Platform Enterprise Edition,是Sun公司为企业级应用推出的标准平台。J2EE:Java 2 Platform,Enterprise Edition,是JavaEE以前的叫法。JDBC:Java DataBase Connectivity,Java数据库连接。JNDI:Java Naming and Directory Interface,提...原创 2019-03-09 20:27:02 · 2123 阅读 · 0 评论 -
【Java】JVM垃圾回收机制与类加载机制
不同于C++需要编程人员手动释放内存,Java有虚拟机,因此Java不需要程序员主动去释放内存,而是通过虚拟机自身的垃圾回收器(Garbage Collector-GC)来进行对象的回收。Java语言由于有虚拟机的存在,实现了平台无关性,在任意平台都是通过将代码转换为字节码文件,从而在平台下的虚拟机中运行代码的。JVM内存区域分布虚拟机栈:存放每个方法执行时的栈帧,一个方法调用到...原创 2019-03-07 20:57:03 · 1965 阅读 · 0 评论 -
【Java】利用数组建立二叉树 & 建立二叉搜索树 & 层序遍历 的简单实现
import java.util.LinkedList;import java.util.Queue;public class Tree { public static class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x...原创 2019-04-22 22:39:28 · 3070 阅读 · 2 评论 -
【leetcode】965. Univalued Binary Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { ...原创 2019-04-22 22:45:16 · 112 阅读 · 0 评论 -
【leetcode】590. N-ary Tree Postorder Traversal
/*// Definition for a Node.class Node { public int val; public List<Node> children; public Node() {} public Node(int _val,List<Node> _children) { val = _val...原创 2019-04-23 01:05:27 · 233 阅读 · 0 评论 -
【leetcode】922. Sort Array By Parity II
class Solution { public int[] sortArrayByParityII(int[] A) { int temp; for(int i=0,j=1; i<A.length; i+=2) { if(A[i]%2!=0) { while(A[j]%2!=0) { ...原创 2019-04-23 01:17:11 · 120 阅读 · 0 评论 -
【leetcode】589. N-ary Tree Preorder Traversal
递归版本/*// Definition for a Node.class Node { public int val; public List<Node> children; public Node() {} public Node(int _val,List<Node> _children) { val = _...原创 2019-04-23 09:32:52 · 130 阅读 · 0 评论 -
【leetcode】557. Reverse Words in a String III
class Solution { public String reverseWords(String s) { String[] words = s.split(" "); StringBuffer sb = new StringBuffer(); for(String word : words) { ...原创 2019-05-07 16:24:51 · 190 阅读 · 0 评论