halfrost / LeetCode-Go

✅ Solutions to LeetCode by Go, 100% test coverage, runtime beats 100% / LeetCode 题解
https://books.halfrost.com/leetcode
MIT License
32.99k stars 5.7k forks source link

763 PartitionLabels 时间复杂度 #236

Closed 0xff-dev closed 2 years ago

0xff-dev commented 2 years ago

您好,昨天做到了这道题,然后和您这边的解法做了一个对比,都是lastIndex的逻辑。readme中写了复杂度是O(n^2),但解法1的start更新为end+1,我觉得时间复杂度是O(n)的。

halfrost commented 2 years ago

@0xff-dev 你说的是对的,我这里写错了。感谢指出,我已经更正了。