Luyu Huang

Results 74 issues of Luyu Huang

https://luyuhuang.github.io/2020/01/16/three-maximum-area-problems.html 笔者在 LeetCode 上看到了三个非常有意思的最大面积问题, 这里来分享一下.1. 接雨水题目源自Leetcode: 接雨水 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度...

Gitalk
23

https://luyuhuang.github.io/2020/03/18/serialize-lua-objects.html 在项目中由于种种需求经常需要将对象序列化成一个字符串. 由于 Lua 唯一的复合结构是 table, 所以实现起来还是比较简单的. 之前我们的做法是用 Lua 写一个递归函数遍历 table 的键值然后转换成字符串并拼接起来. 然而 Lua 在字符串拼接的过程中会不断地构造字符串对象, 因此这样的实现方式性能较差...

Gitalk
27

Hi all, When I try to convert the following html to plain text: ```html aaa bbb ``` the output is ``` aaa bbb ``` but I think there should be...

When I join multiple strings, I don't want to write `'aaa' .. '_' .. 'bbb' .. '_' .. 123`, which is too long; I don't want to use `table.concat` either...