We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
tortise and hare doesn't make any sense...
When the data is not stored up in any structure, the time is enough for just purely comparison and increment count accordingly.
int a = s%mod;
int compare = s%mod;
int count = 1;
for (int i = 1; i < n; i++)
{
a = ((a%mod)*(p%mod)+q%mod)%mod;
if (a != compare)
{
count++;
compare = a;
}
else continue;
}
cout<<count;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bit Array
You are viewing a single comment's thread. Return to all comments →
tortise and hare doesn't make any sense... When the data is not stored up in any structure, the time is enough for just purely comparison and increment count accordingly.