Skip to content

Ambiguity in solution #1

@anishagg17

Description

@anishagg17

I was trying to understand https://github.com/godely/Problems/blob/master/Spoj/ANARC08C.cpp

But there were some concepts that I couldn't understand. It would be great if you could explain me that.

  • For this loop, I could not understand why is j incremented by 2 instead of 1.

for (int j = last; j <= sz-vec[i].S.F; j+=2) {

  • I didn't get how is the value tempHash calculated. ( I get that it is formed by removing the previous part but still why it is not divided by length creates a confusion).

tempHash = hash[j+vec[i].S.F-1] - ((j == 0) ? 0 : hash[j-1]*B[vec[i].S.F]);

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