### gautam94's blog

By gautam94, history, 6 years ago, I tried doing it by finding the minimum removal cost for each score in and then using this to calculate the maximum total score by DP, but this is too slow. Any other ideas will be appreciated. Thanks. dp, spoj,
By gautam94, 7 years ago, I have written this code http://ideone.com/11kNYs for solving this problem http://codeforces.com/problemset/problem/219/C It asks for the minimum number of changes in a string such that no two adjacent characters are same and also only the first k characters can be used. The code is not yet complete as it's only calculating the minimum number of changes. The problem also requires the actual answer with minimum changes. So how to do this? dp,
By gautam94, 7 years ago, Solution: http://ideone.com/XWCBcI

I am using the recurrence relation given here but as you can see it's not giving the correct output for the second case. Please help me find the error. dp, spoj,
By gautam94, 8 years ago, My solution

I am generating primes till sqrt(10**9) using Sieve of Eratosthenes and then calculating divisors of numbers in the given range by dividing them by primes till sqrt(number) but it's getting TLE.

UPDATE:I found my mistake. The sieve implementation is wrong.

UPDATE2:I corrected the Sieve but its still getting TLE. I am using the same algorithm as this New solution spoj, ndiv,
By gautam94, 8 years ago, I am having trouble understanding the nlogn algorithm for solving the LIS problem. I have implemented the algorithm given here on page number 6. Link to CPP implementation. I think it's only checking the subsequence starting at index 0 so how is this algorithm correct? Or is my implementation wrong? Someone please help prove the correctness of this algorithm. Thanks.

By gautam94, 8 years ago, I was reading about hashing from here and I am unable to understand the part about calculation of hash of a substring. I am calculating the hash of the entire input string in this way : h (S) = S  + S  * P + S  * P ^ 2 + S  * P ^ 3 + ... + S [N] * P ^ N

Suppose P = 31 and a = 1, b = 2, c = 3 and so on. Then for the input string abcdab, h = 1, h = 32, h = 2915, h = 122079, h = 1045600, h = 58303902. Now from these values, how can I calculate h[0..1] or h[3..5]? By gautam94, 8 years ago, 386B - Fly, freebies, fly! Please help me understand this solution. 5711342 Is this the two pointers method. Why is the final answer ans = max(ans,j-i) ? 