I dont know if it can be solved in O(n). But O(nlogn) can be done using
BIT. Refer topcoder tutorial for Binary indexed trees.
On Mon, Apr 9, 2012 at 10:56 AM, tarun chabarwal admin20...@gmail.comwrote:
how should i approach this problem
https://www.spoj.pl/problems/DCEPC206/
can it be
node * reverse(node *head)
{
if(head-next)
{
node * temp=reverse(head-next);
head-next-next=head;
head-next=NULL;
return temp;
}
return head;
}
On Sun, Jul 17, 2011 at 4:57 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
*node *reverse(node
i already mentioned the link where i got this approach..
//from spoj forum
I have tried this problem with the following approach:-
1. any expression can be expressed as ))...)+a_correct_expression+((...(
2.at each node i am storing 1.no_of ')' at start and 2.no_of '(' at end of
expression that
i found this good..
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
On Mon, Mar 21, 2011 at 6:02 PM, Anurag atri anu.anurag@gmail.comwrote:
yes , please suggest a nice tutorial for segment trees ..
On Mon, Mar 21, 2011 at 5:48 PM, cegprakash
but..i read this oly after my senior taught me segment trees..
On Wed, Mar 23, 2011 at 4:43 PM, bharath kannan bharathgo...@gmail.comwrote:
i found this good..
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
On Mon, Mar 21, 2011 at 6:02 PM, Anurag atri
I guess you solve it using binary search..
On Wed, Mar 23, 2011 at 6:48 PM, Vishnutej
mylavarapu.vishnu...@gmail.comwrote:
Hello everyone,
Im unable to understand the NUMGUESS problem in SPOJ.Can some one
explain what the problem is about?
Thanks in advance.
-Vishnutej.Mylavarapu
--
, 2011 at 10:40 AM, bharath kannan
bharathgo...@gmail.comwrote:
i thot tat i had some mistake in my code and typed it all over again..
finally i noticed this :)
On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:
Hey..
I also got into same trouble today...
I submitted
http://www.spoj.pl/forum/viewtopic.php?f=3t=5240p=20667hilit=BRCKTS#p20667
if u know d basics of segment tree..then this thread will help for solving
this prob :)
On Sun, Mar 20, 2011 at 2:11 AM, murthy.krishn...@gmail.com
murthy.krishn...@gmail.com wrote:
can any 1 explain why we have 2 use
i thot tat i had some mistake in my code and typed it all over again..
finally i noticed this :)
On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:
Hey..
I also got into same trouble today...
I submitted it 6 times..then got bored and de moralised cause i cudnt find
sorry guyz...
Had to print YES n NO..
i printed as Yes n No...
Got ac..
Sorry for the trouble..
On Wed, Mar 16, 2011 at 10:24 PM, Bharath 2009503507 CSE
bharathgo...@gmail.com wrote:
i am new to segment trees..i tried this problem in spoj..
http://www.spoj.pl/problems/BRCKTS
am getting WA..
a small modification in normal knapsack algo ll do :)
On Thu, Feb 24, 2011 at 4:06 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
http://www.spoj.pl/problems/PIGBANK/
can anyone give me an idea how to solve this problem...?? I dont think
the knapsack algo would be of help here as here we
machi use this..
Define *m*[*i*,*w*] to be the maximum value that can be attained with weight
less than or equal to *w* using items up to *i*.
We can define *m*[*i*,*w*] recursively as follows:
- [image: m[0,\,w]=0]
- [image: m[i,\,0]=0]
- [image: m[i,\,w]=m[i-1,\,w]] if [image:
refer topcoder tutorials..dp
On Wed, Dec 15, 2010 at 12:12 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
how do we find the complexity of DP program ? i know it cn be done
using DP states , but the gien complexity is n^2 . i am not sure how
to compare that
On Tue, Dec 14, 2010 at
I tried solving that prob..here's my code
#includeiostream
#includestring
using namespace std;
main()
{
string s;
cins;
while(1)
{
if(s.size()==1 s[0]=='*')
break;
int length=1,curr=0,start=0,count=1;
for(int i=1;is.size();i++)
{
if(s[i]!=s[curr]
sum of n elements from 1=n(n+1)/2
product from 1 to n=n!
calculate dis..
sum=calculated sum-orig sum
prod=calculated prod-orig prod
with dis form quadratic eq and solve...
hope this works...
On Tue, Oct 12, 2010 at 12:29 AM, Asquare anshika.sp...@gmail.com wrote:
Given an array of size n. It
15 matches
Mail list logo