Re: [algogeeks] Modified String Searching

2013-01-27 Thread Dev Gosain
package pack1; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; public class AGShortestSegment { public static void main(String[] args) { String paragraph = "This is a test. This is a programming test. This is a programming test"; String toFin

Re: [algogeeks] Re: DP equation for interval problem

2013-01-27 Thread Nikhil Karnwal
Actually dp[i] represent the state in which u make a slice at appearing time of i th fruits.and match represent the overlapping fruits with i. so for each i dp[i]=max(dp[i],dp[j]+match); for all j=[0,i] and match =overlapped fruits with i which are not sliced until the cut of j. Hope this will help

Re: [algogeeks] Modified String Searching

2013-01-27 Thread Guneesh Paul Singh
the difference array for range 4-7 is [1,1,0,1] it is not a sol [2,2,1,1](index no 7) -[1,1,1,0](index of 3)