摘要: [LeetCode 772] Basic Calculator III 基本计算器之三 Implement a basic calculator to evaluate a simple expression string. The expression string may contain ope 阅读全文
posted @ 2019-03-04 05:51 ucode 阅读(328) 评论(0) 推荐(0) 编辑
摘要: 构建树状数组,实则就是初始化C数组。对于C数组,我们知道,下标为i的Ci,在树形逻辑结构中,它的父亲是i + 2^k = y,而它父亲的父亲则是y + 2^ k' = m...一直到超出数据范围为止。也就是说,原本的Ai,只会影响Ci及Ci的祖先。 由此,我们定义一个add(x,v)函数,使得它可以 阅读全文
posted @ 2019-03-02 14:50 ucode 阅读(373) 评论(0) 推荐(0) 编辑
摘要: Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of t 阅读全文
posted @ 2019-03-02 13:59 ucode 阅读(162) 评论(0) 推荐(0) 编辑