I use DP to solve this LCS question. 1. I read input interrupt by '#'. 2. Apply DP approach by use two table to store the length and the position of two equal string. 3. Then accord to the table to reconstruct the LCS string.
Actually! I really don't have any clue about what's wrong with it. The only information I got is "Runtime Error" without showing "SIGSEGV"(NullPointerException) or "SIGFPE"(FloatingPointException)
BTW, my size for operators is 50 ,for numbers is 1000. And I do some assert to make ...
Raj Ariyan said : in this type of problem, in my opinion, if u writing n'th line code then u must be sure that 1 to n-1 lines are perfect and bug free. I mean for proceed one line u have to sure that upto this line alls code are error free.
For example, the sequence (2, 0, 1, 4, 3) is an antiarithmetic permutation of 5. The sequence (0, 5, 4, 3, 1, 2) is not an antiarithmetic permutation as its first, fifth and sixth term (0, 1, 2) form an arithmetic progression; and so do its second, forth and ...
1. I translate N,L,U to binary bit. 2. I use a temp array to store the reslut. 3. First, I copy the data from U to temp, and from leading bit to decide following two case.
if(U ==0&&N ==0)
I check if I changed the value and it wouldn't exceed the ...
hi! I try to solve the prob but I got several WA, and I don't know why.
I check TISARKER and misof said.
1. I use long long int to proceed the compute, that is, my code can handle prob's input data without overflow.(array size is 1000) 2. And for each case I can sure no extra space at each end of ...
hi ! I'm trying to solve this problem . I use the alog just like what Dreamer#1 did, but I got WA for serveral times.And now I can't find out what's wrong with my code. 1. I check the input N & H, if N is over 2^H-1 or less than H, and print impossible. 2. And I use recursion to build the tree. 3 ...