原创 LeetCode-E-Same Tree

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

原创 LeetCode-E-Delete Node in a Linked List

題目 Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Sup

原创 LeetCode-M-Sort Colors

題意 Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjace

原创 LeetCode-E-Single Number

題目 Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algori

原创 LeetCode-M-Single Element in a Sorted Array

題意 Given a sorted array consisting of only integers where every element appears twice except for one element which

原创 LeetCode - M - Reverse Linked List II

題意 Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->N

原创 LeetCode-E-Fizz Buzz

題目 Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it sho

原创 LeetCode - E - Reverse Integer

題意 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoil

原创 LeetCode - E - Reverse Linked List

題意 Reverse a singly linked list. click to show more hints. Subscribe to see which companies asked this question. 解法

原创 LeetCode-M-Insertion Sort List

題意 Sort a linked list using insertion sort. 解法 鏈表插入算法實現,記錄已排好序段的表頭和表尾,記錄小於當前值的最大節點,注意三種情況: 鏈表頭插入 鏈表尾插入 鏈表中插入 實現 /

原创 LeetCode - M- Rotate List

題意 Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4

原创 LeetCode - E- Min Stack

題意 Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push ele

原创 LeetCode-M-Binary Tree Zigzag Level Order Traversal

題意 Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then rig

原创 LeetCode-M-Remove Duplicates from Sorted List II

題意 Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the ori

原创 LeetCode-E-Palindrome Linked List

題意 Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space