79276723

Date: 2024-12-12 22:08:54
Score: 1.5
Natty:
Report link

Solution with O(1) time complexity, just check is it possible to get first item of iterator:


first_item = next(iter(iterator), None)

if first_item is None:
    print(f'Iterator is empty')

if first_item is not None:
    print(f'Iterator is NOT empty')

Reasons:
  • Blacklisted phrase (1): is it possible to
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Hayk Avetisyan