摘要: 笔试三道算法题(难度依次递增) 1.有重复字符串(全小写)全排列个数。(易) 组合数学问题:有重集合全排列数(n!/(n1!...nk!)) 例如:abb=>{abb,bab,bba}个数为3,等价于3!/(1!*2!) = 6/(1*2) = 3 2.长度为M的字符串(全小写),去掉K个字符返回字 阅读全文
posted @ 2020-04-30 23:47 All_just_for_fun 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 博弈问题动态规划通用思路 转载:来自大佬https://leetcode-cn.com/problems/stone-game/solution/jie-jue-bo-yi-wen-ti-de-dong-tai-gui-hua-tong-yong/ 该问题主要是如何设计dp数组,其次是动态转移方程 阅读全文
posted @ 2020-04-30 23:13 All_just_for_fun 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 转载(来自我好友):https://xiaolei565.github.io/2020/04/20/Algorithm--Bit%20Operation/ 位运算 算法–位运算 概念 符号描述运算规则 & 与 两个位都为1时,结果才为1 \ 或 两个位都为0时,结果才为0 XOR ^ 异或 两个位相 阅读全文
posted @ 2020-04-30 12:10 All_just_for_fun 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 欧拉筛和埃氏筛法求素数模版 public class Prime { public boolean[] visit; //true代表不是素数,false代表是素数 public int[] prime; //记录着每一个质数值 public int cnt = 0; //记录质数的个数 //欧拉筛 阅读全文
posted @ 2020-04-30 12:02 All_just_for_fun 阅读(213) 评论(0) 推荐(0) 编辑