Skip to content

Suggest corner case scenario #273

@theartofaiml

Description

@theartofaiml

https://github.com/careercup/CtCI-6th-Edition-Python/blame/653e50ccfa927179526879273062628996f392c1/chapter_02/p04_partition.py#L40

Regards to this below line in the method lr_partition(). Is it possible that left.tail is None in some cases? Consider the case where all the elements are greater or equal to x then all elements will go into right list.

left.tail.next = right.head

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