原创 LeetCode103. Binary Tree Zigzag Level Order Traversal題解

1. 題目描述 Given a binary tree, return the zigzag level order traversal of its nodes’ values. (IE, from left to rig

原创 LeetCode406. Queue Reconstruction by Height題解

最近算法課講到了貪心算法,接下來的幾篇題解應該都會與貪心算法相關。 1. 題目描述 Suppose you have a random list of people standing in a queue. Each per

原创 LeetCode110.Balanced Binary Tree題解

1. 題目描述 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree

原创 數媒筆記整理2

最近收拾資料,發現之前的數媒筆記只整理了一篇,這幾天陸續補上吧。 1. 題目:2D transformation, polygon clipping, viewport 1.1. Goal You are to write

原创 LeetCode101. Symmetric Tree題解

1. 題目描述 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). 2. 樣例

原创 LeetCode122. Best Time to Buy and Sell Stock II題解

今天討論一道讓我想的過於複雜的題目:一道有關股票買賣的問題。 1. 題目描述 Say you have an array for which the i th element is the price of a given

原创 LeetCode452. Minimum Number of Arrows to Burst Balloons題解

1. 題目描述 【翻譯過來】: 有若干個氣球,給出了它們的直徑兩個端點的座標(X軸),我們的工作是需要用一支箭來戳破氣球。例如兩個氣球的直徑分別是(1,6)和(2,8),那麼我們就可以在x=6的座標處發射一支箭從而將它

原创 數媒筆記整理4

1. 題目:Implement Gouraud Shading or Phong Shading based on hw3 1.1. Goal You are to write a program to read a se

原创 數媒筆記整理3

1. 題目:Implement an OpenGL-like 3D Rendering Pipeline 1.1. Goal You are to write a program to read a set of comm

原创 LeetCode107. Binary Tree Level Order Traversal II題解

1. 題目描述 Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to

原创 LeetCode455. Assign Cookies題解

1. 題目描述 Assume you are an awesome parent and want to give your children some cookies. But, you should give each

原创 LeetCode513. Find Bottom Left Tree Value題解

1. 題目描述 Given a binary tree, find the leftmost value in the last row of the tree. 2. 樣例 3. 分析 這道題的思路和Leet

原创 LeetCode112.Path Sum題解

1. 題目描述 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the

原创 LeetCode515. Find Largest Value in Each Tree Row題解

1. 題目描述 You need to find the largest value in each row of a binary tree. 2. 樣例 3. 分析 題目的意思很明確,給了一棵樹,需要我輸出