原创 Find Right Interval

Find Right Interval Description Given a set of intervals, for each of the interval i, check if there exists an inte

原创 Reverse a singly linked list

Reverse a singly linked list Description Given a linked list, remove the n-th node from the end of list and return

原创 樹的基本概念以及java實現二叉樹(一)

前言 作爲一個程序員,要了解最基本的數據結構的。本文是我在學習了樹後作的總結文章,本節大致可以總結爲: 什麼是樹 樹的基本性質(專有名詞) 什麼是二叉樹 二叉樹的基本性質 二叉樹的存儲結構 文章傳送門: 樹的基本概念以及jav

原创 Linked List Cycle

Linked List Cycle Description Given a linked list, determine if it has a cycle in it. Tags: LinkedList 解讀題意 判斷該鏈表是不

原创 Valid Palindrome

Valid Palindrome Description Given a string, determine if it is a palindrome, considering only alphanumeric charact

原创 Maximum Depth of Binary Tree

Maximum Depth of Binary Tree Description Given a binary tree, find its maximum depth. The maximum depth is the numb

原创 Binary Tree Level Order Traversal

Binary Tree Level Order Traversal Description Given a binary tree, return the level order traversal of its nodes’ v

原创 Best Time to Buy and Sell Stock II

Best Time to Buy and Sell Stock II Description Say you have an array for which the ith element is the price of a gi

原创 Find Peak Element

Find Peak Element Description A peak element is an element that is greater than its neighbors. Given an input array

原创 Validate Binary Search Tree

Validate Binary Search Tree Description Given a binary tree, determine if it is a valid binary search tree (BST). A

原创 Sqrt(x)

Sqrt(x) Description Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be

原创 4Sum II

4Sum II Description Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are s

原创 Find Minimum in Rotated Sorted Array

Find Minimum in Rotated Sorted Array Description Suppose an array sorted in ascending order is rotated at some pivo

原创 Symmetric Tree

Symmetric Tree Description Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its ce

原创 Kth Smallest Element in a BST

Kth Smallest Element in a BST Description Given a binary search tree, write a function kthSmallest to find the kth