Skip to content

Modified Code #4

Description

@GaryAvc

you could modify this code by changing

modulos.add((int) ((
modulos.get( i ) % m +
modulos.get(i + 1) % m ) % m));

to

modulos.add((int) ((
modulos.get( i ) +
modulos.get(i + 1) ) % m));

it work correctly,
since what you add before is the remainder of m, it have to be smaller than m
So the step of modulos.get(i) %m is useless and meaningless, since modulos.get(i) always <=m
which means
modulos.get(i)%m equal to modulos.get(i)

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