[algogeeks] Re: Amazon Job openings

2021-07-16 Thread immanuel kingston
Please send a note to me on king...@amazon.com Thanks, Kingston On Fri, Jul 16, 2021 at 11:16 AM immanuel kingston < kingston.imman...@gmail.com> wrote: > Hi all, > > I am a hiring manager at Amazon. We are hiring for SDE and Applied Science > roles in my team. Please send

[algogeeks] Amazon Job openings

2021-07-15 Thread immanuel kingston
Hi all, I am a hiring manager at Amazon. We are hiring for SDE and Applied Science roles in my team. Please send a short note about yourself, the role you wish to apply for and your updated CV. Thanks, Kingston -- You received this message because you are subscribed to the Google Groups

[algogeeks] Openings at Amazon - SDE IIs

2017-05-09 Thread immanuel kingston
My team is hiring Software Development Engineers! More about the team "Come join the platform team that develops components and services used to support repeat delivery programs like Subscribe & Save for customers and Recurring Delivery for businesses. Our systems enable Amazon to launch

[algogeeks] Amazon Hiring SDE-Is, SDE-IIs, SDM and QAE-1

2014-07-27 Thread immanuel kingston
There are openings in my team for SDE-Is, SDE-IIs, SDM and QAE-1. Please send me resumes if you or your friends are interested in any of these roles. Thanks, Kingston -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this

Re: [algogeeks] Re: nlogn, in-place, iterative mergesort?

2011-08-07 Thread immanuel kingston
@DK and Amit, thanks for correcting my understanding. On Sun, Aug 7, 2011 at 3:51 PM, amit karmakar amit.codenam...@gmail.comwrote: @DK Hmm, i do understand what you said. Maybe, i should make it clear that i just wanted to tell that implementing a non-recursive merge-sort will not require

Re: [algogeeks] Re: Intersection of 2 rectangles

2011-08-07 Thread immanuel kingston
., take the rectangles [(0,0), (0,3), (3,3), (3,0)] and [(2,5), (5,2), (7,4), (4,7)]. The standard test is the Separating Axis Test. You can find this with google. Dave On Aug 6, 11:38 am, immanuel kingston kingston.imman...@gmail.com wrote: Algo goes something like this. Rectangles

Re: [algogeeks] Intersection of 2 rectangles

2011-08-06 Thread immanuel kingston
Algo goes something like this. Rectangles are represented by two points TopLeft and bottomRight or BottomLeft and TopRight 1. Choose Xmin and Xmax from Rectangle A. Check if any of the x-coordinates of rectangle B fall in between Xmin and Xmax of A. 2. choose Ymin and Ymax from Rectangle A.

Re: [algogeeks] nlogn, in-place, iterative mergesort?

2011-08-06 Thread immanuel kingston
Yes. just remove the recursive part using 2 stacks. Thanks, Immanuel On Fri, Aug 5, 2011 at 6:51 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: does anyone know of any in-place, iterative mergesort algorithm with nlogN worst case complexity? It would be good if it is stable also. TIA

Re: [algogeeks] MS Written Test

2011-07-23 Thread immanuel kingston
Trie is better in terms of scalability and performance. With Hashtable there is a problem of rehashing when all buckets are full and rehashing takes O(N). Although it happens once in a blue moon. That can impact the performance in a production environment. With trie you dont have that problem.

Re: [algogeeks] Interleaving two strings using recursion

2011-07-23 Thread immanuel kingston
I am thinking the following algo will work. Please correct me if i am wrong. void interleaveAndPrint(char * result, char * str1, char * str2, int i ) { if (*str1 == '\0' *str2 == '\0') { result[i] = '\0'; printf(%s\n, result); return; }

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread immanuel kingston
First Player can always win. For each heap Pick heap-size - 1 coins if this is not the n-1th heap Pick all coins from the heap if this the n-1th heap. Please correct me if i am wrong. Thanks, Immanuel On Wed, Jun 15, 2011 at 3:13 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: *There

Re: [algogeeks] MSFT Q

2011-06-15 Thread immanuel kingston
Use a trie data structure and pre-load it with all the words of a dictionary. Thanks, Immanuel On Wed, Jun 15, 2011 at 3:06 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: *How will you design a SpellChecker for an e-mail application?* -- *Piyush Sinha* *IIIT, Allahabad*

Re: [algogeeks] Adobe Q

2011-06-15 Thread immanuel kingston
The following is for LCA for 2 nodes in a n-ary tree. A more tougher problem is to find the LCA for n nodes in the same n-ary tree. Node * findLCA (Node *root, Node * l, Node * r, int n) { if (l == null || r == null) return root; if (root == null) return null; if (isChild(root,l) ||

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread immanuel kingston
. n = 2; heap 1 - no of coins 1 heap 2 - no of coins 2 On Wed, Jun 15, 2011 at 5:34 PM, sunny agrawal sunny816.i...@gmail.comwrote: i think u r wrong what if heap size -1 is 0 i think one should pick atleast one coin else game will draw On Wed, Jun 15, 2011 at 5:17 PM, immanuel

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread immanuel kingston
will win i think On Wed, Jun 15, 2011 at 6:26 PM, immanuel kingston kingston.imman...@gmail.com wrote: Yes. I am wrong. As per the example, Player 2 will win if he plays efficiently. Let me put my solution this way, If all the the heaps are of size 1 the Player 1 can win always. Thanks

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread immanuel kingston
@Nitish, I think it fails for this condition 4 heaps with 1,2,1,2 Player 1 starts first with picking 1 coin from heap 1 Player 2 picks 2 coins from heap 2 Player 1 picks 1 coin from heap 3 Player 2 picks 2 coins from heap 4. Player 2 wins but XOR of the number of coins in each heap is 0(if that

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread immanuel kingston
yep true. The difficult part is trying to find when Player 1 can win with heaps of size 1. Thanks, Immanuel On Wed, Jun 15, 2011 at 6:59 PM, sunny agrawal sunny816.i...@gmail.comwrote: i think solution depends on no of heaps having single coin if there are even number of such heaps player 1

Re: [algogeeks] Re: Find min after rotating an array

2011-05-28 Thread immanuel kingston
Modified Piyush's soln to handle the above case. int get_pivot(int a [ ],int low, int high) { if (low high) { int mid = (low+high)/2; if(a[mid]a[mid+1]) return mid+1; if(a[low]a[mid]) return (get_pivot(a,low,mid-1)); else

Re: [algogeeks] Re: Array Merge Problem

2011-05-28 Thread immanuel kingston
@Ankit, The input should be 2 sorted arrays Thanks, Immanuel On Sun, May 29, 2011 at 10:48 AM, ankit sambyal ankitsamb...@gmail.comwrote: @sravanreddy: it won't work. Try 3,91,9 and 90,1,8,2,5 . correct me if i m wrong. Thanks, Ankit Sambyal On Sat, May 28, 2011 at 9:16 PM, ross

Re: [algogeeks] [brain teaser ] Mystery Puzzle Sherlock Holmes 26 may

2011-05-26 Thread immanuel kingston
Mark On Thu, May 26, 2011 at 1:05 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Mystery Puzzle Sherlock Holmes * * * ** *One snowy night, Sherlock Holmes was in his house sitting by a fire. All of a sudden a snowball came crashing through his window, breaking it. Holmes got up and

Re: [algogeeks] Edit distance

2011-05-25 Thread immanuel kingston
http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance On Wed, May 25, 2011 at 11:50 AM, Akshata Sharma akshatasharm...@gmail.comwrote: still not getting!! :( On Wed, May 25, 2011 at 11:38 AM, Aakash Johari aakashj@gmail.comwrote: Sorry, it can't be because of the

Re: [algogeeks] Arrays

2011-05-25 Thread immanuel kingston
Brute force Approach would be int checkForTriangle(int a, int b, int c) { return (a + b c) (b + c a) (a + c b); } int triangle (int a[], int n) { if (a == null || n = 0) return 0; for (int i=0 ; i n ; i++) { for (int j=i + 1; j n; j++ ) { for (int

Re: [algogeeks]

2011-05-24 Thread immanuel kingston
#define MAX_BITS_FOR_INT=32; int getIthBit(int n, int i) { return (n 1i) i; } bool isPalindrome(int num) { int i=0; int j= MAX_BITS_FOR_INT - 1; while (i j) { int ithbit = getIthBit(num, i); int jthbit = getIthBit(num, j); if ( ithbit ^ jthbit)

Re: [algogeeks]

2011-05-24 Thread immanuel kingston
... For example, taking 10's binary representation as 1010...according to question it wil be a palindrome...but according to ur algo it will return false... On 5/24/11, immanuel kingston kingston.imman...@gmail.com wrote: #define MAX_BITS_FOR_INT=32; int getIthBit(int n, int i) { return

Re: [algogeeks] how to convert a floating point number into binary representation.

2011-05-24 Thread immanuel kingston
correct me if I am wrong. String convertFloatToBinary(float num) { String str = ; int numBeforeDecimal = (int)num; float decimalPart = num - (float)numBeforeDecimal; int sign=1; if (numBeforeDecimal 0 ) sign = -1; if (sign 0) str[str.length] = '-';

Re: [algogeeks] Re: Facebook Interview Question from glassdoor

2011-05-24 Thread immanuel kingston
@sravan, What i meant was get the jth digit in the representation of i to the base NUM_PER_DIGIT. ie 3rd digit of (2137)8 which is 2.. 7 is the 0th digit, 3 being 1st digit, 1 being 2nd digit and 2 being 3rd digit.Here 2137 is a base 8 representation. Thanks, Immanuel On Tue, May 24, 2011 at

Re: [algogeeks] Re: AMAZON Q

2011-05-24 Thread immanuel kingston
int fibArray[INTEGER_MAX_VALUE] = {0}; int fibonacci (int n) { if (n = 0) { return 0; } else if ( n 0 fibArray[n] != 0) { return fibArray[n]; } else { if (n == 1) return (fibArray[n] = 1); return (fibArray[n] = fibonacci(n - 1) + fibonacci(n-2));

Re: [algogeeks] one constructor problem

2011-05-24 Thread immanuel kingston
http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectswithoutreferencingtheconstructordirectly.htm Thanks, Immanuel On Wed, May 25, 2011 at 7:34 AM,

Re: [algogeeks] Re: Facebook Interview Question from glassdoor

2011-05-23 Thread immanuel kingston
Extending the above soln: NUM_PER_DIGIT = 3 char c[][NUM_PER_DIGIT] = {abc,def,...}; char n[] = 2156169 (number is pressed); int k=7; for i -- 0 to NUM_PER_DIGIT ^ k String s=; for j -- 0 to k int index = getJthDigitinItotheBaseNumPerDigit(NUM_PER_DIGIT,i,j); // ie get 1st digit

Re: [algogeeks] Re: Facebook Interview Question from glassdoor

2011-05-23 Thread immanuel kingston
at 9:33 PM, immanuel kingston kingston.imman...@gmail.com wrote: Extending the above soln: NUM_PER_DIGIT = 3 char c[][NUM_PER_DIGIT] = {abc,def,...}; char n[] = 2156169 (number is pressed); int k=7; for i -- 0 to NUM_PER_DIGIT ^ k String s=; for j -- 0 to k int index

Re: [algogeeks] Re: Facebook Interview Question from glassdoor

2011-05-23 Thread immanuel kingston
small correction On Mon, May 23, 2011 at 9:46 PM, immanuel kingston kingston.imman...@gmail.com wrote: A Recursive soln: NUM_PER_DIGIT = 3 char c[][NUM_PER_DIGIT] = {abc,def,...}; char n[] = 2156169 (number is pressed); int k=7; char * s = (char *) malloc(sizeof(char) * k); void

Re: [algogeeks] Re: Facebook Interview Question from glassdoor

2011-05-23 Thread immanuel kingston
, immanuel kingston kingston.imman...@gmail.com wrote: small correction On Mon, May 23, 2011 at 9:46 PM, immanuel kingston kingston.imman...@gmail.com wrote: A Recursive soln: NUM_PER_DIGIT = 3 char c[][NUM_PER_DIGIT] = {abc,def,...}; char n[] = 2156169 (number is pressed); int k=7

Re: [algogeeks] Kingdom Of MapleWood

2011-05-22 Thread immanuel kingston
Since the number of islands is even, either the sum of areas of islands in the even position have a greater area or the ones in the odd position have greater area. Eric can start from the 1st island if the sum of areas of the islands at the odd position is greater than that of even ones.or can

Re: [algogeeks] Re: Need help on Divide and Conquer Algorithm

2011-05-21 Thread immanuel kingston
Solution: int majorityElement(int a[], int n) { if (a == null || a.length == 0 || n=0) return -1; int mElement = a[0]; int count=1; for (int i=1; i n; i++) { if (a[i] == mElement) { count++; } else { count--; } if (count =

Re: [algogeeks] Re: strings

2011-05-20 Thread immanuel kingston
A Recursive solution: int interleaved(char *s1, char *s2, char *s3) { if (s1 == null s2== null s3==null) return 1; if (s3==null) return 0; if (s1 != null *s1 == *s3) return interleaved(s1+1,s2,s3+1); else if (s2 != null *s2 == *s3) return interleaved(s1, s2+1,s3+1);

Re: [algogeeks] Re: strings

2011-05-20 Thread immanuel kingston
:21 pm, immanuel kingston kingston.imman...@gmail.com wrote: A Recursive solution: int interleaved(char *s1, char *s2, char *s3) { if (s1 == null s2== null s3==null) return 1; if (s3==null) return 0; if (s1 != null *s1 == *s3) return interleaved(s1+1,s2,s3+1

Re: [algogeeks] Re: GOOGLE Q

2011-05-20 Thread immanuel kingston
Preprocess the Dictionary into a hash table where the key is the sorted string of each word and the value being the A list that contains that particular word.(O(nlogn * linked list insertion time some k) ) Now for each given word, sort it(O(nlogn)) and find get the list of words that are

Re: [algogeeks] Re: nearest neighbour

2011-05-20 Thread immanuel kingston
I guess a O(nk),O(k) solution exists. Have a maxHeap of k elements in our case its 3. Iterate through the array, compare the (difference between the position along a number line between ) and the top element of the maxHeap. It it happens to be lesser than the top element, pop off the top element

Re: [algogeeks] Re: how to find a smallest prime bigger than a given number

2011-05-20 Thread immanuel kingston
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes On Thu, May 19, 2011 at 1:47 AM, Don dondod...@gmail.com wrote: Yes. Use a sieve. Don On May 17, 11:36 pm, wujin chen wujinchen...@gmail.com wrote: @Daveļ¼Œ thanks for your reply. i know that, i can only check from 6*n - 1 and 6*n + 1..

Re: [algogeeks] Print Subsets

2011-05-20 Thread immanuel kingston
I think your soln will print repetitions also. On Mon, May 16, 2011 at 2:34 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: *int ref[] = {2,3,6,7,8};* *void printcombination(int n,int index,int i) { static int a[100]; int j; if (n == 0) { for(j=0;jindex;j++)