N = p1 ^ K1 * p2 ^ k2 ..
phi(N) = p1^(K1) * (1-1/p1) * .
phi(N) = N * (1 - 1/p1) * (1 - 1/p2) .
phi(N) = (N - N/p1) * (1 - 1/p2)..
so now result which was initally
@Mayank u can directly send hi to her on personal gmail. please dnt spam.
let it be algo group
On Thu, Aug 25, 2011 at 11:42 AM, mayank gaur gaur.mayank.9...@gmail.comwrote:
hi
On Thu, Aug 25, 2011 at 11:37 AM, S MADHU madhu.mca...@gmail.com wrote:
hi
--
Regards
MADHU.
--
You
will all u stop all this. dont put any comments on all this now.
On Wed, Aug 3, 2011 at 11:20 PM, Anil Arya anilarya...@gmail.com wrote:
@coder dumca--- Utkarsh --- google me nahi Goldman Sachs me jane
wala hai..Google ko ye saubhagya prapt nhi hoga
On Wed, Aug 3, 2011
Your code does not works proper;y for all cases
On Mon, Aug 1, 2011 at 10:42 PM, Rohit jalan jalanha...@gmail.com wrote:
Here is the recursive algo:
Rearrange(A,p,q)
1. if p is not equal to q do the following
2. r ← (p+q)/2
3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2].
4.
i+1 * i+1
= 2 * i + 1
for i = 3, j = 7 (2 *3 + 1)
On Mon, Jul 25, 2011 at 6:06 PM, Arshad Alam alam3...@gmail.com wrote:
what should be the output of the following and how..
#includestdio.h
#includeconio.h
#define PRODUCT(x) (x*x)
void main()
{
clrscr();
int i=3,j;
Can think of a O(n^2) solution
On Sun, Jul 10, 2011 at 6:53 PM, raj singh ankurkaku...@gmail.com wrote:
@yogesh- can u explain with an example pls?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
This is mean not the median
On Mon, Mar 28, 2011 at 8:42 PM, Raunak Agrawal raunak.ra...@gmail.comwrote:
I am assuming that the median is the sum of all the values stored in the
nodes divided by 2.
So I am traversing all the nodes recursivelyand finding the median of
them.
On Mon,
beetle
On Tue, Mar 1, 2011 at 1:38 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote:
Riddle Problem Solution
I am an insect. The beginning of my name is another insect's name. What am
i?
Update Your Answers at : Click Here
Solution:
Will be updated after 1 day
--
@ Dave : I think this shud also give the same result
C(26, 3) * C(26, 3) * C(10, 2) * C(62, 2)
On Wed, Feb 9, 2011 at 7:16 PM, snehal jain learner@gmail.com wrote:
how many passwords can be made if
1. there should be atleast 3 capital letters
2. atleast 3 small letters
3. atleast 2
Also it shud now be multiplied with Factorial of 10
On Thu, Feb 10, 2011 at 1:14 AM, Manmeet Singh mans.aus...@gmail.comwrote:
@ Dave : I think this shud also give the same result
C(26, 3) * C(26, 3) * C(10, 2) * C(62, 2)
On Wed, Feb 9, 2011 at 7:16 PM, snehal jain learner@gmail.com
U using extra space, if you using extra space, simple C++ implementation
will be use a priority queue and do BFS.
On Wed, Feb 9, 2011 at 10:47 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote:
@algoseeker
mine approach is also the same but m inserting the elements in a min heap
and you in a
How to design a chess board using OOPS ? ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
test case : a = -1, b = - 1
Result : fight successfully challenged dave's problem. Method returned 1
while it shud have returned -1.
On Sun, Feb 6, 2011 at 4:12 PM, Balaji S balaji.ceg...@gmail.com wrote:
thanks..
--
balaji ;-)
--
You received this message because you are subscribed
8, 32, 96
On Sat, Feb 5, 2011 at 2:46 PM, priya mehta priya.mehta...@gmail.comwrote:
#include stdio.h
#define PrintInt(expr) printf(%s : %d\n,#expr,(expr))
*int* FiveTimes(*int* a)
{
*int* t;
t *=* a**2 *+* a;
*return* t;
}
*int* main()
{
*int*
because u not thinking of operator precedence :P :P
On Sat, Feb 5, 2011 at 2:52 PM, priya mehta priya.mehta...@gmail.comwrote:
why is this happening?
On Sat, Feb 5, 2011 at 2:51 PM, Manmeet Singh mans.aus...@gmail.comwrote:
8, 32, 96
On Sat, Feb 5, 2011 at 2:46 PM, priya mehta
@ Shubham : Well Said :) :)
On Fri, Feb 4, 2011 at 8:01 PM, shubham singh
shubhamsisodia0...@gmail.comwrote:
if (u r calling dp of spoj as basic)
{
i would say u are a champ already ;
}
else
{
do practise more on spoj
}
--
You received this message because you are subscribed to the
C/C++ user : Take input in a char array or string(if using C++) : a
now do string addition. : a = a + a;
now do string substraction. : a = a - 2.
Java user : Use BigInt class
On Fri, Feb 4, 2011 at 8:12 PM, Logic King crazy.logic.k...@gmail.comwrote:
please help me solve the problem on SPOJ
What is incorrect in the given question, except the constraints not given.
On Mon, Jan 24, 2011 at 4:03 PM, juver++ avpostni...@gmail.com wrote:
DP and clarify your incorrect question.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
Also has any one solved https://www.spoj.pl/problems/MONONUM/
with only DP. I would like to know the solution, as my solution works for
small nos. and then the ratio reduces to a simple mathematical formula.
On Mon, Jan 24, 2011 at 4:09 PM, Manmeet Singh mans.aus...@gmail.comwrote:
What
ok, i thought he wanted the both, but he means ratio i guess. So, its the
same problem.
On Mon, Jan 24, 2011 at 4:21 PM, juver++ avpostni...@gmail.com wrote:
@fight incorrect -
how to calculate the number of the decreasing *n*-digit integers to the
increasing *n*-digit integers
--
You
@JUVER++ : One personal question. Is this algo groups paying you something
or you among the admins :) :). As in every problem I find your name and with
a superb solution.
On Mon, Jan 24, 2011 at 4:26 PM, Manmeet Singh mans.aus...@gmail.comwrote:
ok, i thought he wanted the both, but he means
n / 9.0 + 1 for n 20 works, before that I apply a simple DP. even i want
to know a gud DP based solution for the problem, with no formula used, as I
have done.
On Mon, Jan 24, 2011 at 11:43 PM, Logic King crazy.logic.k...@gmail.comwrote:
hey, but what's the solution to the problem...how
Number exponentiation
On Fri, Jan 21, 2011 at 1:05 PM, snehal jain learner@gmail.com wrote:
Given M, find if M = 3^x for some positive integer x efficiently. DO
NOT think of log, pow etc
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
this will be O(log(n) * log(n)) solution
On Fri, Jan 21, 2011 at 4:29 PM, abhijith reddy abhijith200...@gmail.comwrote:
Below is code for modular exponentation in general
// (a^b)%c
int modexp(int a,int b,int c)
{
int ans=1;
while(b)
{
if(b1) ans=(ans*a)%c;
On Fri, Jan 21, 2011 at 5:24 PM, Manmeet Singh mans.aus...@gmail.comwrote:
this will be O(log(n) * log(n)) solution
On Fri, Jan 21, 2011 at 4:29 PM, abhijith reddy
abhijith200...@gmail.com wrote:
Below is code for modular exponentation in general
// (a^b)%c
int modexp(int a,int b,int c
@juver++ : the above is a user defined function. but its possible to the
problem using bit wise operators.
On Fri, Jan 21, 2011 at 7:29 PM, juver++ avpostni...@gmail.com wrote:
@above it's a user-defined function using fast exponentiation
--
You received this message because you are
write n, n-1 to base 3
check if thr gives 0, if it gives no. is of form 3^n
On Fri, Jan 21, 2011 at 8:04 PM, snehal jain learner@gmail.com wrote:
@manmeet
how?
On Fri, Jan 21, 2011 at 7:36 PM, Manmeet Singh mans.aus...@gmail.comwrote:
@juver++ : the above is a user defined function
@ juver++ : fight is my tc handle. here u can call me manmeet :) :)
On Fri, Jan 21, 2011 at 9:35 PM, juver++ avpostni...@gmail.com wrote:
@fight good solution.
3^n contains only one 1 in the 3-base representation.
So write number M in base-3, and check if it contains only one digit(1).
how merge sort ?/
On Thu, Jan 20, 2011 at 11:23 PM, nishaanth nishaant...@gmail.com wrote:
Ya as Ashish said hashing is the best solution :)
On Fri, Jan 14, 2011 at 6:00 PM, Ashish Goel ashg...@gmail.com wrote:
ideally, a hashMap would be preferred
walk through one array and set the
whts complexity for this movegen()
On Fri, Jan 21, 2011 at 9:52 PM, nishaanth nishaant...@gmail.com wrote:
Ok lets define the following functions.
movegen()- gives the list of next move given the state. This is basically
all the 1 distance words given the current word.
heuristic()- this
It can be done in O(n) space too using DP :) :).
U dont need that flag, but that solution u said is absolutely correct.
On Thu, Jan 20, 2011 at 7:27 PM, Decipher ankurseth...@gmail.com wrote:
There is a row of houses in which each house contains some amount of money.
Write an algorithm that
; i++)
{
S[i] = Math.Max(S[i - 2], S[i - 3]) + A[i];
maxloot = Math.Max(maxloot, S[i]);
}
return maxloot;
}
On Jan 20, 7:30 pm, Manmeet Singh mans.aus...@gmail.com wrote:
It can be done in O(n) space too using DP
1-D simple dp with state current index you are at
On Wed, Jan 5, 2011 at 7:41 AM, Akash Agrawal akash.agrawa...@gmail.comwrote:
didn't get the question correct...
Can u cite an example...
Regards,
Akash Agrawal
http://tech-queries.blogspot.com/
On Wed, Jan 5, 2011 at 12:36 AM, Decipher
Can you elaborate how to put segment tree into picture
On Wed, Jan 5, 2011 at 2:57 PM, juver++ avpostni...@gmail.com wrote:
Right. It can be solved simply in O(n^2). To optimize use segment trees.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
int solve(int id) {
if(id==n)
return 0;
int d = dp[id];
if(~d) return d;
d = 0;
for(int i=id+1;in;i++) {
if(dis[i]-dis[id]=k) {
d ?= val[id] + solve(i);
}
}
return d;
}
Its O(n^2), and Juver++, is very
I am telling the DP O(n^2) solution, whts wrong in it??
On Wed, Jan 5, 2011 at 10:36 PM, juver++ avpostni...@gmail.com wrote:
Unfortunately, you are wrong.
We need one loop for i and that is all. All other things for searching max
p[j] is solved by segment tree in O(log n).
--
You received
ok :):)
On Wed, Jan 5, 2011 at 10:43 PM, juver++ avpostni...@gmail.com wrote:
I was replying to the @Decipher post. Not yours. :)
Your algorithm seems to be ok.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
In main just pass
answerIs = max(val[0], solve(0));
On Wed, Jan 5, 2011 at 10:49 PM, juver++ avpostni...@gmail.com wrote:
Sorry, disregard my first proposition about index i.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
Go through gates in Electronics, code will be easy to visualize.
On Fri, Dec 31, 2010 at 6:33 PM, juver++ avpostni...@gmail.com wrote:
Yeah, add bits one by one from right to left, as for ordinary addition of
two numbers in 10-th radix
--
You received this message because you are subscribed
class BadNeighbors {
public:
int maxDonations(vector int);
};
int dp[51][2][2];
int l;
vectorint v;
int solve(int id, int taken, int first) {
if(id==l)
return 0;
int d = dp[id][taken][first];
if(~d) return d;
d = 0;
if(id!=l-1) {
if(taken==0) {
d
When you pass an array as argument, it gets broken into a pointer. So you
get size as 4 for 32 bit machine.
On Tue, Dec 14, 2010 at 10:59 PM, Divesh Dixit
dixit.coolfrog.div...@gmail.com wrote:
#define SIZE 10
void size(int arr[SIZE])
{
printf(size of array is:%d\n,sizeof(arr));
41 matches
Mail list logo