原创 LeetCode-Add Digits-解題報告

原題鏈接 https://leetcode.com/problems/add-digits/ Given a non-negative integer num, repeatedly add all its digits until

原创 LeetCode-Missing Number-解題報告

原題鏈接 https://leetcode.com/problems/missing-number/ Given an array containing n distinct numbers taken from 0, 1, 2,

原创 LeetCode-Ugly Number II-解題報告

原鏈接https://leetcode.com/problems/ugly-number-ii/ Write a program to find the n-th ugly number. Ugly numbers are posi

原创 C++11 - lambda

使用lambda可以編寫匿名的內嵌函數 語法 [capture_block](parameters)mutable exception_specification ->return_type{body} capture_block:捕

原创 c++模版元編程

編譯時計算階乘 #include<iostream> using namespace std; template<int n> class Factorial{ public: enum{ value = n * Factorial

原创 LeetCode-Integer to English Words-解題報告

原題鏈接 https://leetcode.com/problems/integer-to-english-words/ Convert a non-negative integer to its english words repr

原创 LeetCode-Median of Two Sorted Arrays-解題報告

原題鏈接 https://leetcode.com/problems/median-of-two-sorted-arrays/ There are two sorted arrays nums1 and nums2 of size m a

原创 LeetCode-Single Number-解題報告

原題鏈接 https://leetcode.com/problems/single-number/ Given an array of integers, every element appears twice except for o

原创 LeetCode-Lowest Common Ancestor of a Binary Search Tree-解題報告

原題鏈接 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ Given a binary search tree (BST), f

原创 LeetCode-Add Two Numbers-解題報告

原題鏈接 https://leetcode.com/problems/add-two-numbers/ You are given two linked lists representing two non-negative numbe

原创 LeetCode-Binary Tree Paths -解題報告

原題鏈接 https://leetcode.com/problems/binary-tree-paths/ Given a binary tree, return all root-to-leaf paths. For exampl

原创 LeetCode-Number of Digit One-解題報告

原題鏈接 https://leetcode.com/problems/number-of-digit-one/ Given an integer n, count the total number of digit 1 appearin

原创 LeetCode-Ugly Number-解題報告

原鏈接 https://leetcode.com/problems/ugly-number/ Write a program to check whether a given number is an ugly number. Ug

原创 LeetCode-String to Integer (atoi) -解題報告

原題鏈接 https://leetcode.com/problems/string-to-integer-atoi/ Implement atoi to convert a string to an integer. Hint: Car

原创 LeetCode-Reverse Integer-解題報告

原題鏈接 https://leetcode.com/problems/reverse-integer/ Reverse digits of an integer. Example1: x = 123, return 321Example2