Re: [algogeeks] Need help

2018-04-22 Thread Saurabh Paliwal
roup and stop receiving emails from it, send an > email to algogeeks+unsubscr...@googlegroups.com. > -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks&quo

Re: [algogeeks] Find all the subarrays in a given array with sum=k

2016-02-21 Thread Saurabh Paliwal
4 -11 3 4 8} > > You have to print {from index, to last index} so for above example {0, > 3}; {0,8}; {7,8} is the answer > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To unsubscribe from this group and

Re: [algogeeks] Re: Find max sum of elements in an array ( with twist)

2016-01-12 Thread Saurabh Paliwal
least one of them to move forward). >> >> eg :- >> >> 10 , 20 , 30, -10 , -50 , 40 , -50, -1, -3 >> >> Output : 10+20+30-10+40-1 = 89 >> >> > -- > You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

Re: [algogeeks] DP problems

2014-06-05 Thread Saurabh Paliwal
from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop

Re: [algogeeks] DP problems

2014-06-05 Thread Saurabh Paliwal
, it did not work. But i think the brute force solution is possible in O(n^3) solution. We have O(n^2) combination of end points. we can check for the maximum possible even length palin string in O(n). So that will give O(n^3). Anyone has solution about O(n^2)? On 5 June 2014 22:25, Saurabh Paliwal

Re: [algogeeks] DP problems

2014-06-05 Thread Saurabh Paliwal
Ok! So I guess now we are talkng my solution. What i do is maintain two pointers i and j, i is the end of the first string and j is the beginning of the second. If both the character match, I calculate the answer for pointers i-1,j+1 and add 1 to the answer for i,j. If they don't match, I simply

Re: [algogeeks] DP problems

2014-06-05 Thread Saurabh Paliwal
by memoization. On Thu, Jun 5, 2014 at 11:37 PM, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: Ok! So I guess now we are talkng my solution. What i do is maintain two pointers i and j, i is the end of the first string and j is the beginning of the second. If both the character match, I

Re: [algogeeks] DP problems

2014-06-05 Thread Saurabh Paliwal
is the answer So time complexity = space complexity = O(n^2). Correct me if i am wrong On 5 June 2014 23:44, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: And now I get what you meant when you said palindrome. You should have explained that if that was not exact palindrome So yes

Re: [algogeeks] Solving equation

2014-01-27 Thread Saurabh Paliwal
Ws On 27 Jan 2014 17:02, saurabh singh saurab...@gmail.com wrote: ^ No its not invalid. It just represents an equation with infinitely many correct solutions depending on the domain of x. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Mon, Jan 27,

Re: [algogeeks] coloring problem Dynamic programming

2013-12-28 Thread Saurabh Paliwal
care that 3 adjacent are colored different. could you please clarify my doubt. On Thu, Dec 26, 2013 at 5:25 PM, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: @atul anand :- no, we need not use all the colors. @kumar raja :- sorry dude for replying this late. Continuing

Re: [algogeeks] coloring problem Dynamic programming

2013-12-26 Thread Saurabh Paliwal
. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] coloring problem Dynamic programming

2013-12-16 Thread Saurabh Paliwal
, kumar raja rajkumar.cs...@gmail.com wrote: Saurabh your solutions seems right , but can u explain me how did u arrive at the time and space complexity with some proof /pseudocode/ explanation? On 15 December 2013 09:47, Saurabh Paliwal saurabh.paliwa...@gmail.comwrote: what is the issue

Re: [algogeeks] coloring problem Dynamic programming

2013-12-14 Thread Saurabh Paliwal
is minimized. Regards, Kumar Raja. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- -Saurabh Paliwal

Re: [algogeeks] variation of LIS problem

2013-10-25 Thread Saurabh Paliwal
: @pankaj : how can you maintain increasing sub-sequence using heapyour soln is for finding finding K largest element in the array...so it wont work. On 10/24/13, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: check for {5,2,3} and K = 2. On Thu, Oct 24, 2013

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread Saurabh Paliwal
.87fri...@gmail.comwrote: @Saurabh Paliwal : yes On 10/24/13, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: Do you mean *of all the increasing subsequences of length k in this array, find the one with maximum sum ?* On Wed, Oct 23, 2013 at 10:52 PM, atul anand atul.87fri

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread Saurabh Paliwal
nothing insert 55 (before inserting 50 delete the root of heap as count of heap == 3), deleted root was - 5 so the output will be {10,30,55} and if k is 4 than {5, 10, 30 , 55) On Thu, Oct 24, 2013 at 6:20 PM, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: You must be mistaken

Re: [algogeeks] variation of LIS problem

2013-10-23 Thread Saurabh Paliwal
Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google

Re: [algogeeks] Need an optimized solution.

2013-10-20 Thread Saurabh Paliwal
I submitted the solution on hackerrank and got Accepted. There is a change though, there may be more terms like Term (r+1) but this can also be done using O(1). Term (r+2) : (2*n+1 - (r+2)*k)/2 and so forth until numerator becomes zero. You can use the same technique to get this sum as well.

Re: [algogeeks] Need an optimized solution.

2013-10-18 Thread Saurabh Paliwal
, Pankaj Kumar Joshi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- -Saurabh Paliwal B-Tech. Comp

Re: [algogeeks] Need an optimized solution.

2013-10-18 Thread Saurabh Paliwal
there is a minor correction in definition of r, actually r is the maximum of all the numbers i such that *i*k-1=n.* On Fri, Oct 18, 2013 at 2:38 PM, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: I think I have an O(1) solution to this problem. I think we can use the idea of summing

Re: [algogeeks] Leaf nodes from inorder traversal

2013-03-16 Thread Saurabh Paliwal
Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg

Re: [algogeeks] Re: Print tree node which sum

2013-03-08 Thread Saurabh Paliwal
. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr

Re: [algogeeks] Re: Print tree node which sum

2013-03-08 Thread Saurabh Paliwal
this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you

Re: [algogeeks] Re: Algo Question

2013-02-26 Thread Saurabh Paliwal
emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: FInd unique element.

2013-02-22 Thread Saurabh Paliwal
...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from

Re: [algogeeks] Re: FInd unique element.

2013-02-22 Thread Saurabh Paliwal
...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from

Re: [algogeeks] sortin 2D array

2013-01-08 Thread Saurabh Paliwal
the elements should be in sorted order. For example: for the above 2-D array, the output should be: A [ ] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16, 21, 22, 35, 40, 58 } -- -- -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE --

Re: [algogeeks] how does this code achieve SIGSEGV

2012-12-21 Thread Saurabh Paliwal
Allahabad B.Tech IT 4th Year Mob no: +91 9454992196 E-mail: rit2009...@iiita.ac.in jprakha...@gmail.com -- -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE --

Re: [algogeeks] how does this code achieve SIGSEGV

2012-12-17 Thread Saurabh Paliwal
. -- -- -Saurabh Paliwal B-Tech. Comp. Science and Engg. IIT ROORKEE --