原创 LeetCode(107)——Binary Tree Level Order Traversal II

題目: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, leve

原创 LeetCode(102)——Binary Tree Level Order Traversal

題目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level

原创 LeetCode(101)——Symmetric Tree

題目: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this bi

原创 LeetCode(541)——Reverse String II

題目: Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from t

原创 LeetCode(557)——Reverse Words in a String III

題目: Given a string, you need to reverse the order of characters in each word within a sentence while still preserving w

原创 LeetCode(100)——Same Tree

題目: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the

原创 LeetCode(543)——Diameter of Binary Tree

題目: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is t

原创 LeetCode(110)——Balanced Binary Tree

題目: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined

原创 LeetCode(617)——Merge Two Binary Trees

題目: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees ar

原创 LeetCode(1)——Two Sum

題目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may a

原创 初始化時代碼塊執行順序

本文講下類在初始化加載時,靜態代碼塊、構造代碼塊、構造函數以及有父類時的執行順序。 1、無父類時 看個例子就一目瞭然了。 public class TempTest { private static final Logger

原创 【Java基礎】try、catch、finally

本文通過幾個示例來研究try、catch、finally和return結合起來的各種情況。 示例1: public String finallyTest() { String s = null; try { Sys

原创 LeetCode(268)——Missing Number

題目: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the arra

原创 【Java基礎】equals和hashcode

一、equals equals是Object類的其中一個方法,默認的實現方法爲 public boolean equals(Object obj) { return (this == obj); } 可以

原创 【Java基礎】int和Integer

Java中存在8種基本數據類型:byte(8位)、short(16位)、int(32位)、long(64位)、float(32位)、double(64位)、char(16位,0x0000~0xffff)、boolean(true/fals