如何知道时间复杂度? [已关闭]

问题描述 投票:0回答:1

我在多个 DSA 中看到的问题是 (1, <= nums.length , <= 105) so if the constraints are given then how do I know the exact or estimate time complexity after seeing the constraints ??? can someone explain in an easy way??

我看到了很多限制,但我无法找出问题的时间复杂度,你能帮助我吗?

c++ data-structures time-complexity constraints
1个回答
0
投票

如果给定大小约束,则时间复杂度为 O(1)。仅当输入大小可变时才会发生非常数复杂度。

© www.soinside.com 2019 - 2024. All rights reserved.