@juver++..write ur algo.. i will see that..
Thanks Regards
Shashank Mani
--
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
When we can convert Derived* to Base* then why can't we convert Derived** to
Base** ??
--
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
There is a row of houses in which each house contains some amount of money.
Write an algorithm that loots the maximum amount of money from these houses.
The only restriction is that you cannot loot two houses that are directly
next to each other.
--
You received this message because you are
dp[i][flag] - max amount up to the i-th house (i-th house is included into
final result if flag = true).
--
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
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 think its correct.
On Jan 19, 9:35 pm, nishaanth nishaant...@gmail.com wrote:
How about the following dynamic programming solution.
Let dp[i] be the max no of As with i keystrokes.
dp[i]=max(dp[i-1]+1,2*dp[i-3])
dp[N] is the required solution.
Correct me if i am wrong.
On Wed, Jan
The reason is simple. The same thing happen in other language such as JAVA.
You can convert Derived class to Base class but you can't convert Derived[]
to Base[]. The reason is, if your Base class has two derived classes D1, D2.
They can exist in Base[] because D1, D2 are valid Base instances.
static int MaxLoot(int[] A, int n)
{
int[] S = new int[n];
S[0] = A[0];
S[1] = A[1];
S[2] = S[0] + A[2];
int maxloot = Math.Max(S[1], S[2]);
for (int i = 3; i n; i++)
{
S[i] =
extending the above example
Base B;
DerivedClasses D1, D2;
B's content - {content_of_B }
D1's content - { content_of_B, D1_specific_data_and_functions}
D2's content - { content_of_B, D2_specific_data_and_functions}
Can you see the reason now? The above is a very simplified example, think of
Simple Conditional probability formula...Ans B)
On Fri, Jan 14, 2011 at 9:04 PM, Jammy xujiayiy...@gmail.com wrote:
Bayes' theorem:
http://en.wikipedia.org/wiki/Bayes'_theoremhttp://en.wikipedia.org/wiki/Bayes%27_theorem
P(x=even|x3) = P(x3|x=even)*P(x=even)/P(x3)===B
On Jan 14, 2:29 am,
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 corresponding entry, and then through
another array, if any entry found, then they are not
@^ Just check ur solution for boundary case ( n = 2) .. M$ is *generally*
very strict about such mistakes :)
Programmers should realize their critical importance and responsibility in a
world gone digital. They are in many ways similar to the priests and monks
of Europe's Dark Ages; they are the
I dnt get the iterative version. Can u explain it. I can do it top down in
O(n) with state index
I am at.
On Thu, Jan 20, 2011 at 11:30 PM, Avi Dullu avi.du...@gmail.com wrote:
@^ Just check ur solution for boundary case ( n = 2) .. M$ is *generally*
very strict about such mistakes :)
Write a program which prints all the combination of 10 A's and 10 B's .
--
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
1.
int const SIZE = 20;
int const MAX_MASK = (1 20);
FOR (set, MAX_MASK) {
int a = amount of 1's in the set;
if (a == SIZE / 2) print set;
}
2. int current = (1 10) - 1; // set is ...A...BBB
int max = (1 20) - 1 - current;
while (current != LARGE) {
print set;
current = next
According to me Nishaanth's solution is incorrect, as let for n =10, your
output : m=16
but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.
On Thu, Jan 20, 2011 at 9:24 PM, abhijith reddy d
but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.
Try this on a notepad. you will only 15A's
On Thu, Jan 20, 2011 at 12:46 PM, Saikat Debnath saikat@gmail.comwrote:
According to me Nishaanth's
Please send profiles to upen...@erpanderp.com
Requirements:
Position Title :SAP QM
Start date :ASAP
Duration :Long term
Location: Lebanon, NJ
Primary Skills :A minimum of 5 years of QM module experience is required
preferably SAP ECC6
Job Description :
Quality Management (QM) – Onsite
L and R values have great significance to language designers and compiler
builders. They have some significance to language users, but most people
don't have to think about them because the distinction is common sense.
In your case, operates on L-values and always produces an R-value.
---
oldman wants to stay in better touch using some of Google's coolest new
products.
If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-769dc2752a-6e0a13f068-6VoQ4T-LSU9ZLrSQtN38SsrBB10
You'll need
Hi,
I think this method will work:
Possible Number of A's = N/2(1+R)
where R=N-(N/2+3)
assuming 11/2 = 5
Thanks
Preetam
On Fri, Jan 21, 2011 at 2:29 AM, Anand anandut2...@gmail.com wrote:
but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
resulting in 7 keystrokes. then
There is a TV avid person. HE wants to spend his max time on TV. There
are N channels with different program of different length and diff
times. WAP so that the person cam spend his max time watching TV.
Precondition: If that person watches a program, he watches it
completely.
Ex:
Channel1: prog1
If pairwise sums of ‘n’ numbers are given in non-decreasing order
identify the individual numbers. If the sum is corrupted print -1
Example:
i/p:
4
4 5 7 10 12 13
o/p:
1 3 4 9
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Simple DP is here. Problem is similar to maximum total length of
non-intersected segments.
--
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
A sequence of numbers is called a zig-zag sequence if the differences
between successive numbers strictly alternate between positive and
negative. The first difference (if one exists) may be either positive
or negative. A sequence with fewer than two elements is trivially a
zig-zag sequence.
For
Whats the range of length ?
On Fri, Jan 21, 2011 at 11:42 AM, snehal jain learner@gmail.com wrote:
An ideal string is a string where the 1-based index of the first
occurrence of each letter is equal to the number of occurrences of
that letter in the string. For example, the “BAOOOA” is an
Sort all program with their starting time.
Appy the below pseudo code to find max number of programs he can watch.
for(i=i;ilen;i++)
{
/*Check for overlap */
if(p[i].start p[i-1].end)
{
end = i;
}
else
{
/*Index of the first program to be watch*/
See Topcoder Dynamic Programming Tutorials :)
On Fri, Jan 21, 2011 at 12:48 PM, snehal jain learner@gmail.com wrote:
A sequence of numbers is called a zig-zag sequence if the differences
between successive numbers strictly alternate between positive and
negative. The first difference (if
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.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group,
Divide a list of numbers into groups of consecutive numbers but their
original order should be preserved.
Example:
8,2,4,7,1,0,3,6
Two groups:
2,4,1,0,3 8,7,6
Better than O(n^2) is expected.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
30 matches
Mail list logo