原创 Sicily 1000. 詞法分析程序設計 **

Description 設一語言的關鍵詞、運算符、分界符的個數與單詞如下:  struct { int number; string str[10]; } keywords={3,"int","main","return"} ; //

原创 LeetCode 464. Can I Win--動態規劃

題目鏈接 464. Can I Win In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The

原创 LeetCode 316. Remove Duplicate Letters--貪心算法

題目鏈接 316. Remove Duplicate Letters Given a string which contains only lowercase letters, remove duplicate letters so

原创 安裝 go 語言開發環境(ubuntu 16.04)

參考的是這一篇博客:博客地址 1.大概等10幾分鐘就安裝好了 2.檢測是否安裝: 結果: 3.建立一個go的工作區文件夾,添加環境變量GOPATH 4.寫一個helloworld測試一下: // hello.go pac

原创 LeetCode 95. Unique Binary Search Trees II&96. Unique Binary Search Trees--動態規劃,二叉樹

題目鏈接 96. Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store valu

原创 LeetCode 85. Maximal Rectangle&221. Maximal Square--動態規劃

題目鏈接 221. Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1'

原创 cobra安裝

安裝cobra go get -v github.com/spf13/cobra/cobra 會報錯,因爲/src下缺少了golang.org文件夾,還有裏面的sys,text文件夾,偷個懶,找了個現成的拖進去了這裏下載 然後就可以用啦,

原创 回溯法解決八皇后問題

八皇后是一個古老而著名的問題,是回溯算法的典型案例。該問題是國際西洋棋棋手馬克斯·貝瑟爾於1848年提出:在8×8格的國際象棋上擺放八個皇后,使其不能互相攻擊,即任意兩個皇后都不能處於同一行、同一列或同一斜線上,問有多少種擺法。 高斯

原创 動態規劃經典入門級題目*2及詳解

題目來自極客學院的視頻教程-動態規劃(一) 一句話解釋動態規劃:多階段最優化決策解決問題的過程 解題技巧:只關注狀態轉移(子問題之間的關係),不要考慮某個狀態是怎麼出現的 1.字符串解碼 一個只包含大寫字母的字符串加密後變成了只包含數字

原创 安卓 使用Snackbar Failed to resolve: com.android.support:design:26.0.0 解決方案

使用Snackbar首先要在build.gradle app中添加庫的依賴 compile 'com.android.support:design:26.+': 注意上面兩個的版本號一致,否則會遇到Failed to resolve:

原创 LeetCode 37. Sudoku Solver--回溯法

題目鏈接 37. Sudoku Solver Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicate

原创 LeetCode 279. Perfect Squares--動態規劃

279. Perfect Squares Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4,

原创 LeetCode 42. Trapping Rain Water

題目鏈接 42. Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar

原创 LeetCode 131. Palindrome Partitioning--回溯法

題目鏈接 131. Palindrome Partitioning Given a string s, partition s such that every substring of the partition is a palin

原创 LeetCode 135. Candy--貪心算法

題目鏈接 135. Candy There are N children standing in a line. Each child is assigned a rating value.  You are giving cand