摘要:
问题: 给定一个数组,想象成一个桶。问最多能装多少水?例【1,5,3,6】 最多装2格水 O O ~ O O ~ O O O O O O O O O O O解题思路: 我们把每一列当成一块板,根据分析,第一块板和最后一块板一定不能蓄水,所以问题变成了所有板所能蓄水最大值的总和。先明确这个思路,之后再 阅读全文
摘要:
一 、table扩展 -- 返回table大小 table.size = function(t) local count = 0 for _ in pairs(t) do count = count + 1 end return count end -- 判断table是否为空 table.empt 阅读全文
摘要:
--[[-- 用指定字符或字符串分割输入字符串,返回包含分割结果的数组 local input = "Hello,World" local res = string.split(input, ",") -- res = {"Hello", "World"} local input = "Hello- 阅读全文