Easy
Count Tested Devices After Test Operations — Python
Full explanation · Time O(n) · Space O(1)
# Time: O(n)
# Space: O(1)
# simulation
class Solution(object):
def countTestedDevices(self, batteryPercentages):
"""
:type batteryPercentages: List[int]
:rtype: int
"""
result = 0
for x in batteryPercentages:
if x > result:
result += 1
return result