list

[Leetcode] Factor Combinations 因数组合

Factor CombinationsNumbers can be regarded as product of its factors. For example,8 = 2 x 2 x 2; = 2 x 4.Write a function that takes an integer n and return all possible combinations of i

arguments.callee

一道面试题:有一个 n = 5 不用for 循环 返回[1,2,3,4,5]数组 function arr(n){var list = [];return (function(){list.unshift(n);n --;if (n !== 0 ){arguments.callee()};return list}()); } console.log(arr(5)) //[

Permutations(46)

Permutations Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], an

Subsets

Subsets Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets

Combination Sum

Combination SumGiven a set of candidate numbers (C) and a target number (T), find allunique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen f

PHP foreach 一点细节

//非正常function getSonIDs(&$list, $fid = 0){ static $ids = array(); foreach($list as $id => $pid){ if($pid == $fid){ unset($list[$id]); $ids[] = $id;

还在用ListView?

还在用Lisview?RecyclerView都已经出来一年多了!想必大家多或多或少的接触过或者了解过RecyclerView,为什么没有用起来,原因大概如下?ListView我用的挺好的,为什么要换RecyclerView?ListView稳定,熟悉,还知道很多开源库,特别的好用!RecyclerView不能添加头部,ListView能!RecyclerView在Ando

364. Nested List Weight SumII

题目:Given a nested list of integers, return the sum of all integers in the list weighted by their depth.Each element is either an integer, or a list -- whose elements may also be integers o

巧用SASS之如何遍历n个子元素并为其设置属性

最近在新项目中引入了 SASS 来编写样式代码,心想既然用到了这种高端货,就要用得巧用得妙,不能单纯地只是把常用属性定义成变量或定义重用的代码块等等。因此在编写样式时,都要时刻提醒自己是不是可以巧用SASS来解决一些问题。这次遇到的需求是, 里有7个重复的 1. ,这7个 需要应用7中不同颜色的 background-color ,需求很简单,如下是简易的效果图。针对这

[Leetcode] Pascal's Triangle II 杨辉三角

Pascal's Triangle II Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. 从后往前覆盖法 复杂度 O(N) 时间 O(K) 空间 思路 一行一行地迭代,后面一行迭代覆盖前一行,窍门是:从后往前算