FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

3_odd_even_numbers.py code is not optimised · Issue #75 · codebasics/data-structures-algorithms-python · GitHub

3_odd_even_numbers.py code is not optimised  #75

Description

max = int(input("Enter max number: "))

odd_numbers = []

for i in range(1, max):
if i % 2 == 1:
odd_numbers.append(i)

print("Odd numbers: ", odd_numbers)

The loop is Executed 0(n) times we can reduce as 0(n/2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL