原创 (LeetCode 191) Number of 1 Bits

題: Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Ha

原创 (LeetCode 79) Word Search

Q: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of s

原创 關於matlab程序打包成exe可執行文件或者jar包的常見問題

近期由於項目需要,需要把之前的matlab程序打包成exe可執行文件或者jar包,真的是,心,力,交,瘁,我把近兩天打包遇到的各種奇葩問題在這裏總結一下: 代碼中儘量避免出現中文,無論是註釋也好還是程序裏,因爲真的,真的,很容易

原创 (LeetCode 299) Bulls and Cows (HashTable)

Q: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend

原创 (LeetCode 304) Range Sum Query 2D - Immutable

Q: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (r

原创 (LeetCode 223) Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom le

原创 (LeetCode 303) Range Sum Query - Immutable

Q: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example:

原创 (LeetCode 322) Coin Change

Q: You are given coins of different denominations and a total amount of money amount. Write a function to compute

原创 (LeetCode 231)Power of Two

題: Given an integer, write a function to determine if it is a power of two. 也就是判斷一個數是不是2的冪次方 solution: 這道題解法很多,最簡

原创 (LeetCode 264) Ugly Number II

Q: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only includ

原创 (LeetCode 307) Range Sum Query - Mutable(樹狀數組講解)

Q: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The upda

原创 讀取指定文件夾中所有文件名以及文件路徑,並讀到matlab

怎麼可以把一個文件中所有文件名或者文件路徑讀取到一個txt文件中這個時候,在cmd命令行下面的dir命令就很合適,那麼使用下面命令即可: dir path\folder /on /b /s > path\list.txt 舉個例子: 我在

原创 (LeetCode 307) Range Sum Query - Mutable(Segment Tree)

Q: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The updat

原创 (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 326)Power of Three

po主第一篇LeetCode練習 題: Given an integer, write a function to determine if it is a power of three. Follow up: Could y