Woncz Blog

快乐生活,快乐编程

arts week15

arts

Algorithm LeetCode算法题 17. 电话号码的字母组合 78. 子集 131. 分割回文串 Java 程序实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 class Solution_LC17 { String[] alpha = new String[] {""...

Red Packet Algorithm

algos

微信红包 微信红包,依托其强大的社交基因,短时间内占据个人支付的广阔市场,撕开支付宝苦心经营多年的领地,本文试图从技术的角度剖析随机红包算法的实现方案 约束条件 全局约束: 每个人的红包金额取值范围[1, 20000], 单位分,发红包时,需要对红包金额、红包个数校验,不满足约束则创建红包失败(生成失败或者无法提交) 红包约束: 针对具体单个红包,当...

arts week14

arts

Algorithm LeetCode算法题 402. 移掉K位数字 Java 程序实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 class Solution { public String removeKdigits(String num, int k) { if (num == null ...

arts week13

arts

Algorithm LeetCode算法题 91. Decode Ways Java 程序实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 class Solution { public int numDecodings(String s) { if (s == null || s.len...

JCP

Java concurrent programming

Java concurrent programming [TOC] 基础理论篇 CPU、OS,多任务抢占式 上下文切换 同步VS异步、并行VS并发、死锁VS活锁、 JVM实现机制 JMM:原子性、可见性、有序性 指令重排:Happen-Before规则、as-if-serail规则 临界区 Java对象头:JVM规范,排他锁,轻量级锁,偏向锁 JD...

arts week12

arts

Algorithm LeetCode算法题 212. Word Search II Java 程序实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51...

arts week11

arts

Algorithm LeetCode算法题 46. Permutations Java 程序实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 class Solution { public List<List<Integer>> permute(int[] nums) { List&...

arts week10

arts

Algorithm LeetCode算法题 42. Trapping Rain Water Java 程序实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 class Solution { public int trap(int[] height) { int total = 0; ...

arts week09

arts

Algorithm LeetCode算法题-10 Given an input string (s) and a pattern (p), implement regular expression matching with support for ‘.’ and ‘*’. ’.’ Matches any single character. ‘*’ Matches zero or mor...

arts week08

arts

Algorithm LeetCode算法题 Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ...