Skip to content

Integer Issue with LongestIncreasingSubsequence.java #2

@hollowthought

Description

@hollowthought

Hey I found an issue with your code LongestIncreasingSubsequence.java

Line 18: int mid = (int) Math.ceil((low + high)/2);

The Ceiling algorithm won't have any effect because the decimal portion is already truncated.
Changing 2 to 2.0 will force the quotient to be a floating point.

int mid = (int) Math.ceil((low + high)/2.0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions