u can have multiple strings with the same hash code. how abt the case of the string chars being randomized?
i can think of the below; let me kow if u see issues
1. Let the paper size is m x n
2. Small paper piece dimention: sm x sn
3. compute: pieces = modulus( m/sm ) * modulus( n/sn )
4. compute: pieces2 = modulus( m/sn ) * modulus( n/sm )
5. return max ( pieces2, pieces)
I can think of the below
1. Have 2 windows; and keep them 2 digits apart
2. Each window has 2 pointers; max, Min, and variable: Sum as sum btw max, min pointers
3. get sum of left window and right; if they are same print it out
4. Slide the windows by a digit to right.
5. On slide we know the old index of min; subtract the value from the Sum; we konw the new index of max so add that value to the Sum
the complexity should be o(n)
Multiple samples of Thread dumps should help. Looking at the dump u can know what all threads are waiting and on what object.- r November 09, 2014