Re: [algogeeks] convert a word into a palindrome with minimum addition of letters to it

2011-09-04 Thread hemank lamba
@Sukran: This wont work for the test case like this for example the word is Nitan: then the word ur algorithm will create is Nitanatin hence the number of additions =4 but ideal case i would be nitatin : where number of additions is only 2. On Sun, Sep 4, 2011 at 11:11 PM, sukran dhawan

Re: [algogeeks] subarray wid sum=k

2011-09-02 Thread hemank lamba
Are you sure it is not continuous subsets. Because otherwise i guess it is a NP problem. On Fri, Sep 2, 2011 at 7:58 AM, manish kapur manishkapur.n...@gmail.comwrote: given an unsorted array of +ve and -ve elements.find a subarray with sum= k in O(n). you can use some extra space -- You

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread hemank lamba
The problem in this solution might be the fact that you will get the sub array only if the prefix sum is k... so here we are not using prev index. On Fri, Sep 2, 2011 at 3:17 PM, WgpShashank shashank7andr...@gmail.comwrote: I Think We can Use HashTable , as Its Sub-Array you are asking about ,