Re: [algogeeks] Urgent Need ITIL Service Management Operations Business/Process Analyst in Manhattan, NY for 6+ months

2015-09-10 Thread Shashwat Anand
Can we please get rid of this spammer ? On Thu, Sep 10, 2015 at 1:53 AM, Shachindra A C wrote: > ^^ +1 > > On Wed, Sep 9, 2015 at 12:54 PM, Rahul Vatsa > wrote: > >> Please block this guy. >> >> On Thu, Sep 10, 2015 at 1:08 AM, Shaik Asif

Re: [algogeeks] Openings in Adobe India !!!

2014-10-14 Thread Shashwat Anand
People seems to confuse algogeeks with job board. No idea, how can we get rid of these spam. On Tue, Oct 14, 2014 at 2:25 PM, Ashish Mehta mehta.ashis...@gmail.com wrote: There are multiple openings in Adobe India for Developer position. Send me your resume ASAP. Here is the list of urgent

Re: [algogeeks] DP problems

2014-06-05 Thread Shashwat Anand
I am not too sure about your O (N^3) solution even. Can you link the working code ? On Thu, Jun 5, 2014 at 6:48 PM, kumar raja rajkumar.cs...@gmail.com wrote: This is a very good collection of DP problems. I want the answers for problem 2(e) and problem 14. for problem 14 the recurrence

Re: [algogeeks] DP problems

2014-06-05 Thread Shashwat Anand
, and it works. On 5 June 2014 18:53, Shashwat Anand m...@shashwat.me wrote: I am not too sure about your O (N^3) solution even. Can you link the working code ? On Thu, Jun 5, 2014 at 6:48 PM, kumar raja rajkumar.cs...@gmail.com wrote: This is a very good collection of DP problems. I want

Re: [algogeeks] Re: Solving coin change problem with limited coins.

2014-05-16 Thread Shashwat Anand
@Don int coins [] = {1, 3, 5}; int cnt [] = {7, 3, 1}; int S = 9; Your code returns 9, for the aforementioned test case. Should not it return 3 ? Here is my take which takes O (|number of denominators| x |S| x |maximum count for any coin|) time and O (|number of denominators| x |S|) time. It

Re: [algogeeks] Remove minimum set of vertices to make the grap divided into more than one component

2014-04-29 Thread Shashwat Anand
On Tue, Apr 29, 2014 at 10:33 PM, atul anand atul.87fri...@gmail.comwrote: find articulation point in graph It won't work. Say there are N nodes and every node is connected to every other node. This graph does not have any articulation point. You need to remove more than one vertex in this

Re: [algogeeks] Remove minimum set of vertices to make the grap divided into more than one component

2014-04-29 Thread Shashwat Anand
On Tue, Apr 29, 2014 at 4:56 PM, shashi kant shashiski...@gmail.com wrote: Problem is as follows: You have given a terrible description of problem. 1. Given a connected graph. Connected, how ? Is the graph directed or undirected ? 2. Remove a vertex out of it and if graph is divided

Re: [algogeeks] Integer partition problem - DP

2014-03-01 Thread Shashwat Anand
Let us assume you have sum S. The possible numbers it is made up are { 1, 2, .., S }. Now, for every number belonging to the set, you have two options. 1. Subtract currently chosen number from the given set to sum. 2. Choose next number. The state will be defined as (num, sum), where num is the

Re: [algogeeks] Permuations with stack constraints

2014-02-20 Thread Shashwat Anand
Think in binaries. '1' = push, '0' = pop. So a sequence of operations will consist of 0's and 1s. Say N = length of set. Property 1: count of 0 = count of 1 = N. There will be N push and N pop. Property 2: At any point count of 1s = count of 0s. 1100 is valid. [2 push, 2 pop.] 1001

Re: [algogeeks] Re: Find 3 digit number.

2014-02-13 Thread Shashwat Anand
@Don, amazing solution. Let us say, I don't have the insight to see the greedy solution mentioned by @Don there is an obvious dp solution for the general case. typedef long long int64; const int64 LINF = (int64) 1e16 + 5; map int64, int64 memo; int64 solve (int n) { if (n 10) return n;

Re: [algogeeks] Find 3 digit number.

2014-02-12 Thread Shashwat Anand
Since the limit is so small, won't a simple bruteforce do ? Just run a loop from [100, 1000) and return the minimum. Here is a quick python code I wrote. N = 24 min (i for i in range (100, 1001) if int (str (i) [0]) * int (str (i) [1]) * int (str (i) [2]) == N) 138 N = 36 min (i for i in

Re: [algogeeks] strictly sorting by adding or subtracting a range of numbers

2014-01-29 Thread Shashwat Anand
How about a normal binary search ? We know that X can be [0, 2^31 - 1]. Also if X is a valid configuration, all the values above X will too. Monotonicity is all we need here. So, take lo = 0 and hi = 2 ^ 31 - 1. Now check, if your mid is a valid X. If yes, X can lie between [0, mid]. If not, X

Re: [algogeeks] Job Openings at Adobe India

2014-01-08 Thread Shashwat Anand
We need active moderators who can ban these guys spamming the list. This group deals with algorithm problems, we don't need salesmen and brokers here. On Wed, Jan 8, 2014 at 1:42 PM, RM rmath...@gmail.com wrote: Job postings to this mailing list should be marked as spam, and the senders

Re: [algogeeks] D

2013-12-26 Thread Shashwat Anand
Yes, we know now that you are a proud owner of Apple iPod. On Fri, Jan 2, 1970 at 9:32 AM, Chitra chitradevi.ramachand...@gmail.comwrote: Sent from my iPod -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group

Re: [algogeeks] [Algogeeks] Longest increasing sub sequence length in linear time

2013-12-16 Thread Shashwat Anand
On Tue, Dec 17, 2013 at 1:30 AM, bujji jajala jajalabu...@gmail.com wrote: Given an Array of integers (A1,A2,...,An) of length n, Find the maximum possible length of increasing sub sequence formed from A1, A2,,An. I read that it is possible to compute in linear time as mentioned in

Re: [algogeeks] Spoj FARIDA

2013-05-22 Thread Shashwat Anand
On Wed, May 22, 2013 at 9:45 AM, emmy foramlakh...@gmail.com wrote: problem : http://www.spoj.com/problems/FARIDA/ what is wrong with this code? The algorithm is pretty straight forward Is it ? 1000 1 1 1000 Your code gives 1001 as output. Desired output should be 2000. -- You received

Re: [algogeeks] Re: Amazon interview question

2013-04-13 Thread Shashwat Anand
coefficient of T is 0, to make it O(1) solution. That does not seems to be the case here. Say, for 4th iteration, what will be your answer ? I don't see any closed form here. On Wed, Apr 10, 2013 at 7:03 AM, Shashwat Anand m...@shashwat.me mailto:m...@shashwat.me wrote: On 4/10/13

Re: [algogeeks] Re: Amazon interview question

2013-04-09 Thread Shashwat Anand
On 4/10/13 12:13 AM, rahul sharma wrote: If you have any other solution ..please post that...i thnik recursion is ok with base case...we need to scan again after first iteration...?? First of all, the array size and number of iteration both won't be N or else the answer will always be 0. I take

Re: [algogeeks] Re: how to solve this?

2013-04-04 Thread Shashwat Anand
@Dave solution is perfect. I prefer it over mind. However, here is an alternate solution. We know that this is an equation in 'x' with a degree of 1. It means it is a straight line and root is guaranteed unless of course the equation is of the form y = c. That is not the case here as it would

Re: [algogeeks] Least Common Ancestor in STL MAP

2013-03-22 Thread Shashwat Anand
On 3/21/13 5:02 PM, Avinash wrote: Given a STL map, say mapint, bool m1. Given two value a b that may or may not exists in m1. Find the Least Common Ancestor in STL MAP. Remember you don't have access to root, so you need to iterate using iterator. Use the methods/function of MAP forex begin,

Re: [algogeeks] Leaf nodes from inorder traversal

2013-03-16 Thread Shashwat Anand
Ambiguity lies in the heart of this question. If you are given a tree and you want to look for leaf nodes you can simply do an inorder traversa, and check for leaf nodes. Time complexity will be O(N) and space complexity will be O(log N). void getLeafNodes (node *root) { if (! root)