[algogeeks] Re: Programming Problem
i think we cannot change the order of the characters On Thursday, 19 July 2012 11:00:20 UTC+5:30, gobind hemb wrote: String s is called *unique* if all the characters of s are different. String s2 is *producible* from string s1, if we can remove some characters of s1 to obtain s2. String s1 is *more beautiful* than string s2 if length of s1 is more than length of s2 or they have equal length and s1 is lexicographically greater than s2. Given a string s you have to find the *most beautiful unique* string that is producible from s. *Input:* First line of input comes a string s having no more than 1,000,000(10^6) characters. all the characters of s are lowercase english letters. *Output:* Print the most beautiful unique string that is producable from s *Sample Input:* babab *Sample Output:* ba *Explanation* In the above test case all unique strings that are producible from s are ab and ba and ba is more beautiful than ab. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/xq8pHByKW9kJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
#include stdio.h #include stdlib.h #include ctype.h char *decrypt(char *s) { int n; char *digit = (char *)malloc(sizeof(char) * 5); char *p1 = (char *)malloc(sizeof(char) * 1024); char *p = p1; char *digit2; char prev; prev = *s; *p++ = *s++; while(s != '\0') { if(isdigit(*s)) { digit2 = digit; while(isdigit(*s)) *digit2++ = *s++; *digit2 = '\0'; n = atoi(digit); while(n 1) { *p++ = prev; n--; } } prev = *s; if(*s != '\0') *p++ = *s++; else{ *p = *s; break; } } *p = '\0'; return p1; } int main() { char *s = a10b10c1d3e4; char *s2 = decrypt(s); printf(%s, s2); return 0; } On Wed, Jul 25, 2012 at 6:46 AM, Sathish babu satbrucei...@gmail.comwrote: can anyone provide the code to convert ab1cd3 to abcddd **~Sathish Babu~** On Tue, Jul 24, 2012 at 11:39 PM, Mind Boggler min.b...@gmail.com wrote: Traditional decryption problem Convert a3b2c5 into aaabbc Can anyone Put forward an algo for the test case: a3b1c3d1 Thanx -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
logic is very simple ...just trace the program you will understand. On Wed, Jul 25, 2012 at 7:28 PM, Navin Kumar algorithm.i...@gmail.comwrote: #include stdio.h #include stdlib.h #include ctype.h char *decrypt(char *s) { int n; char *digit = (char *)malloc(sizeof(char) * 5); char *p1 = (char *)malloc(sizeof(char) * 1024); char *p = p1; char *digit2; char prev; prev = *s; *p++ = *s++; while(s != '\0') { if(isdigit(*s)) { digit2 = digit; while(isdigit(*s)) *digit2++ = *s++; *digit2 = '\0'; n = atoi(digit); while(n 1) { *p++ = prev; n--; } } prev = *s; if(*s != '\0') *p++ = *s++; else{ *p = *s; break; } } *p = '\0'; return p1; } int main() { char *s = a10b10c1d3e4; char *s2 = decrypt(s); printf(%s, s2); return 0; } On Wed, Jul 25, 2012 at 6:46 AM, Sathish babu satbrucei...@gmail.comwrote: can anyone provide the code to convert ab1cd3 to abcddd **~Sathish Babu~** On Tue, Jul 24, 2012 at 11:39 PM, Mind Boggler min.b...@gmail.comwrote: Traditional decryption problem Convert a3b2c5 into aaabbc Can anyone Put forward an algo for the test case: a3b1c3d1 Thanx -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] adobe aptitude test
can anybody tell me which topics are asked in adobe apti test...and what is the usual level of qs asked in aptitude test... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/hdqti4gC8igJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] output
anybdy has basic trie implementation (insertion and printing) ? o/p 1) main() { char *p1=Name; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf(%s\n,p2); } ...it's giving me empty string 2) i=5; printf(%d,i++ * i++); o/p and also tell the reason? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Wk5StwVUxQMJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1=Name; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout\n NOT ENOUGH SPACE; else { while(*p2++=*p1++); printf(%s\n,save); } for the second qs o/p = 25 cz post incr means first use den incr thererfore 5*5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/lOll02QN_pwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: output
for the first, p2 has moved beyond null character, so do char *c=p and then print string for c. for second , since the same object is modified more than once between two sequence points, so it gives compiler dependent answer.if it wud have been i++||i++ , then the answer would have been defined as || is a sequence point. On Wed, Jul 25, 2012 at 8:42 PM, deepikaanand swinyanand...@gmail.com wrote: for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1=Name; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout\n NOT ENOUGH SPACE; else { while(*p2++=*p1++); printf(%s\n,save); } for the second qs o/p = 25 cz post incr means first use den incr thererfore 5*5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/lOll02QN_pwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Vindhya Chhabra -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
On Wednesday, 25 July 2012 20:20:02 UTC+5:30, jatin wrote: anybdy has basic trie implementation (insertion and printing) ? o/p 1) main() { char *p1=Name; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf(%s\n,p2); } ...it's giving me empty string 2) i=5; printf(%d,i++ * i++); o/p and also tell the reason? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/_rwcRL6t5ywJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
For the first o/p even though i save it like u have done then too it's showing me an empty string . for 2nd as Vindya has stated it should give me error but my compiler is showing me 30 as it's output(the ans shd be 25 if not error) ? On Wednesday, 25 July 2012 20:42:56 UTC+5:30, deepikaanand wrote: for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1=Name; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout\n NOT ENOUGH SPACE; else { while(*p2++=*p1++); printf(%s\n,save); } for the second qs o/p = 25 cz post incr means first use den incr thererfore 5*5 On Wednesday, 25 July 2012 20:42:56 UTC+5:30, deepikaanand wrote: for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1=Name; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout\n NOT ENOUGH SPACE; else { while(*p2++=*p1++); printf(%s\n,save); } for the second qs o/p = 25 cz post incr means first use den incr thererfore 5*5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/fNnV9Hvd4bkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: [Amazon]
every element in 3D array can be written in the form of *(*(*(a+i)+j)+k) = a[i][j][k] ele = required element to be searched for say M = number of 3D matrices R = number of row C = number of col First find the most probable matrix in which the element might be present fix j = R-1 fix k = C-1 //as index starts from 0 max = *(*(*(a+i)+j)+k) //which is a[i][R-1][C-1] min = ***(a+i) //which is a[i][0][0] where is varies from 0 to M-1 now if ele =min ele = max then index = i; //index = required matrix number Now search as u shall search in 2D matrix keeping i constant and varying j and k -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Bo3X7D2XPPQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
On Wednesday, 25 July 2012 20:59:47 UTC+5:30, jatin wrote: For the first o/p even though i save it like u have done then too it's showing me an empty string . for 2nd as Vindya has stated it should give me error but my compiler is showing me 30 as it's output(the ans shd be 25 if not error) ? ahh..ther's sumthng wrong with my compiler .. wen am running it online it's givng me the correct answ. On Wednesday, 25 July 2012 20:42:56 UTC+5:30, deepikaanand wrote: for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1=Name; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout\n NOT ENOUGH SPACE; else { while(*p2++=*p1++); printf(%s\n,save); } for the second qs o/p = 25 cz post incr means first use den incr thererfore 5*5 On Wednesday, 25 July 2012 20:42:56 UTC+5:30, deepikaanand wrote: for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1=Name; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout\n NOT ENOUGH SPACE; else { while(*p2++=*p1++); printf(%s\n,save); } for the second qs o/p = 25 cz post incr means first use den incr thererfore 5*5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/xmObT3iqWaQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
@ jatin then there is something wrong I executed d same prog which I have pasted here...it was giving me the correct answer and for the second qs has no absolute answer it depends on compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/TOSg6xbES24J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
Trie ??if u have it to mail kardio... On Wednesday, 25 July 2012 21:10:55 UTC+5:30, deepikaanand wrote: @ jatin then there is something wrong I executed d same prog which I have pasted here...it was giving me the correct answer and for the second qs has no absolute answer it depends on compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/u5wkXT6ZDHIJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: output
Well Guys, M here just to show wats hpning.. Have your own views.. 1 Everything is right till While loop.. I mean p1 pointing to the heap of the address of the String Name , P1 getting 20 bytes of memory chunk and so on.. So here we go now. As this Stupid looking while is culprit here as it is coping the content of one pointer to other as well as moving itself forward. So What happened when While exits, is p1 points to NULL and is copied successfully to p1 but due to post incrementation of p1 and p2 both are momentary lost and wen't beyond the '\0' character.. So when U print it it goes printing all the rest of 20 character bytes losing it front values. hope U guys have u r clear picture now. 2 Is compiler dependent but can be kinda predictable. Reason:- 1 STL says the two point rule as someone stated above. Coz they feared if this rule does not followed that big chaos might happen but here its simple and kinda predictable. 2 Anyone who have worked or know a bit of Embedded can easily tell how the hardware operated on this equation. Prem On Wed, Jul 25, 2012 at 9:10 PM, deepikaanand swinyanand...@gmail.comwrote: @ jatin then there is something wrong I executed d same prog which I have pasted here...it was giving me the correct answer and for the second qs has no absolute answer it depends on compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/TOSg6xbES24J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: output
sent... On Wednesday, July 25, 2012 9:18:46 PM UTC+5:30, jatin wrote: Trie ??if u have it to mail kardio... On Wednesday, 25 July 2012 21:10:55 UTC+5:30, deepikaanand wrote: @ jatin then there is something wrong I executed d same prog which I have pasted here...it was giving me the correct answer and for the second qs has no absolute answer it depends on compiler On Wednesday, July 25, 2012 9:18:46 PM UTC+5:30, jatin wrote: Trie ??if u have it to mail kardio... On Wednesday, 25 July 2012 21:10:55 UTC+5:30, deepikaanand wrote: @ jatin then there is something wrong I executed d same prog which I have pasted here...it was giving me the correct answer and for the second qs has no absolute answer it depends on compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/fsXZTCbPuIgJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.