what about post increment??
On Sun, Jul 8, 2012 at 10:37 PM, mitaksh gupta mitak...@gmail.com wrote:
the o/p will be 2 not 1 because of the post-increment operator.
On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:
int i=5;
i=++i/i++;
print i;
i=1
how?
does ur sol seems lyk incerasing 1 if next number is greater that prev n
decreasing 1 if less..???
--
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,
@sanjay it's not like that
e.g : (3 5 6 7 8 4) 7
1 2 3 4 5 1 2
Yes we have to increase just by one, but while decreasing choose the lowest
possible such that each trivial component, if it is in decreasing phase,
should end with 1.
On Mon, Jul 9, 2012 at 12:53 PM, sanjay pandey
int i=5;
i=++i/i++;
print i;
i=1
coz ++ operator in c has preference from right to left, therefor first
(i++ is ca;cu;ated) i=5 is used then it's incremented ie i=6 now. Now at
this point of time ++i is calculated, which makes i=7;
finally / operator is performed and i=7/5 is calculated, which
Given an array A and the elements stored in an array denotes how much jump
an element can make from that array position. For example there is an array
A = {4 0 0 3 6 5 4 7 1 0 1 2}
Now Ist element which is 4 can make a jump to element 0, 0, 3 and 6. You
are stuck if you end up at 0.
You have to
There is a greedy solution discussion about this approach. I don't have a
formal proof for this.
Any counter example will be helpful.
at every place 'k' .. do the following.
-- find max ( a[k+i]+i ) where 1 = i = a[i]
for the given example:
A = {4 0 0 3 6 5 4 7 1 0 1 2}
initially a 4, the
Properties of cryptographic hash functions will help.
so, sending a hash of a value is the best option.
as its nearly impossible to find a value for a given hash.
http://en.wikipedia.org/wiki/Cryptographic_hash_function#Properties
both server and client using same hash function will solve this.
take a test case:
1 2 3 4 5 6 3 2 6 9 10 12 6 5 4 3 2 1
the subarrays then are:
(1 2 3 4 5 6 3 2 ) (6 9 10 12 6 5 4 3 2 1)
1 2 3 4 5 6 5 44 5 6 7 6 5 4 3 2 1 --candies allotment on
solving subarrays..
here both are given same candies which is
i dont think it will work like u said...7/5i think it will go as
6/6=1..explain nyone???
On Mon, Jul 9, 2012 at 6:38 PM, Firoz Khursheed firozkhursh...@gmail.comwrote:
int i=5;
i=++i/i++;
print i;
i=1
coz ++ operator in c has preference from right to left, therefor first
(i++ is
a very good counter example. for the approach. even thought you didn't
solve as per my solution.
(1 2 3 4 5 6 3 2) (6 9 10 12 6 5 4 3 2 1)
A small change to the original algorithm. The candies to max. element in
each trivial array is
max(elements_before_it + 1 ,elements_after_it) + 1
And,
But, the problem is the server may be having some data sets, and he
may hash to get some values, he will compare those with that of the
hash values given by the client. Then, he will come to know the
possible values which the client has sent with some probability
--
With love and regards,
Again, the properties of hash function guarentees the preimage resistance,
in the link.
so, if given a hash, its difficult to find a message that has the provided
hash.
Also, yes.. with some probability. 1/(2^256) -- which is very very very
less.
(and can be considered to be 0, looking at the
I was trying to solve this.. was somewhat close before I looked at ur
solution.
But.. equal probability for 1-12 (1 inclusive is a good hint for putting on
0's)
On Saturday, 7 July 2012 15:58:35 UTC-4, Abhishek Sharma wrote:
@Raj: trace karke dekh na yaar when u have 3 0s and 3 6s.. the
Looks pretty standard. It starts by placing one queen on each square of the
bottom row, then working up through the
rows trying to put a queen in each column. If it can place a queen it gets
added as a possible solution.
The always test in the inner loop checks the 'rook' horizontal and then the
@Atul
thanx for the code its working for the example you took...Please check
the same for i/p abcmno,abcmnop
Algo displays:- mno
It should display mno
mnop...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
Is there any solution which will take care deleting a node Given only a
pointer to a node to be deleted in a singly linked list(
*How Do we consider deleting the last node*) *
*
*Subhransu
*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
The constant time removal of last node in a SLL is the limitation of
approach you have in mind.
-- I read it in somewhere (may be Cracking Coding interview 4th edition)
if we have access to head.. then.. its the trivial O(n) time.
On Monday, 9 July 2012 16:06:17 UTC-4, subharansu wrote:
Is
No there is no way to delete the last node in such a situation
though u can replace the info part of such a last node with
'#'though it wont delete the node but now u know that u can
traverse the list while node-info != '#'
--
You received this message because you are subscribed to the
Give the first first number and set of cosecutive diffrence.
On Sunday, 8 July 2012 10:55:55 UTC+5:30, Sairam wrote:
How do you find the intersection of two sets in a secured way?
Which means imagine a situation where there is a client who has got a set
S1={1,2,3}, and there is a server
Well, when i compiled the code the output ie i is alway i=2,
http://ideone.com/AFljo
http://ideone.com/87waz
This expression is ambiguous, and compiler dependent.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
http://www.geeksforgeeks.org/archives/13209
On Mon, Jul 9, 2012 at 7:02 PM, Akshat Sapra sapraaks...@gmail.com wrote:
Given an array A and the elements stored in an array denotes how much jump
an element can make from that array position. For example there is an array
A = {4 0 0 3 6 5 4 7 1 0
What is best approach to find max sum in a circular array...
--
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
You have 8 coins. 3 of them weigh x units, 3 y units, 1 a units and 1 b
units. They are all mixed and look identical. What are the minimum no of
weighings reqd to seperate the for types of coins???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
23 matches
Mail list logo