Saturday, November 5, 2016

SPOJ Problems Hints


Problem Number: 302 Problem Name : Count on Cantor
Catagory : Pattern Finding
Sit on the chair-table with pen & paper.You will then see it creates a triangle.Also,try to find out another pattern for faster implementation :) If it's a "ODD" length triangle,it increases from bottom to top.If it is "Even" length triangle,it increases from top to bottom.Now,gear up yourself for getting Accepted :)

Problem Number: 2727 Problem Name : ARMY - Army Strength
Catagory : Easy AD-Hock
No need to use array/vector/priority_queue. Look at the problem, weakest strength army will be killed from that side.If weakest strength army in the both sides,then you have to do a deletion process from the MechaGodzilla's side.This process will give you a TLE. Just think a little bit more! Yep! Which side belongs to the strongest strength army will be won.If both side's strongest strength equal,this time MechaGodzilla will be lost :)

Problem Number: 95 Problem Name : STPAR - Street Parade
Catagory : Stack,Easy AD-Hock
You have to re-arrange your love car in ascending order which is starting from 1 ,ending at n. First find out 1.After that or before that which are not in the correct position,keep them one by one into stack. Then every time when you will get an element which is the next position(1,2,...,N) ,check out top value from stack.If top value is the next position,then do pop up operation from the stack and keep doing this process untill top value not equal next position (And check out whether your stack is empty or not). After finally if your stack is empty,then obviously you have already  done that!Otherwise,correct re-arrange is impossible to construct :)

Problem Number: 379 Problem Name : PERMUT2 - Ambiguous Permutations
Catagory : Easy AD-Hock
Don't feel weired if you don't get the problem. Read this problem more & more carefully.Hope,you will get that! One point is that it's not a permutation problem.It's an indexing problem.From given array,you have to put value at new array index.After constructing new array,compare both of them.If both are equal,say that's an ambiguous,otherwise not.

Problem Number: 1436 Problem Name : PT07Y - Is it a tree
Catagory : Depth First Search
Simple DFS is effective.And remember if(edge!=node-1),then that graph will not construct a tree.Because,greater than (node-1) edge,obviously cycle will be created. 

No comments:

Post a Comment