LeetCode
cathar
这个作者很懒,什么都没留下…
展开
-
杨辉三角(Pascal's Triangle)- LeetCode118-119
记得之前用 python/JS 实现过,用 java 重写.一些结论: ArrayList.add(index,value) 数组在特定位置添加元素后,之后元素整体后移; 每次都是先添加首位元素,之后计算 [1-tmp.size()-2]之间的元素; 求全量杨辉三角则 res.add(new ArrayList(tmp)); 求某行的是直接 return tmp; 求全量杨辉三角 LeetCode原创 2017-03-26 22:24:20 · 408 阅读 · 0 评论 -
图搜索-DFS-N皇后(N-Queens)
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each solut原创 2017-04-20 13:46:30 · 706 阅读 · 0 评论