Re: [algogeeks] difference b/w static global variables and global variables
Scope might be diferent if u define static in function . it will be intilaized once when u call it first time but scope of that variable will be limited to that function only but they live throught out the programe though scope is limited in case of global it can be used in ny function On Sat, Feb 25, 2012 at 10:35 PM, Akanksha . akanksha...@gmail.com wrote: Global variable are accessible from other file as well but static global variables are only accessible in that particular file. On Sat, Feb 25, 2012 at 10:21 PM, AMAN AGARWAL mnnit.a...@gmail.comwrote: Hi , Is there any difference b/w static global variables and global variables ??? (apart from that static variables will be limited to that file only and global variables will be visible for other files also.) Regards, Aman. -- AMAN AGARWAL Success is not final, Failure is not fatal: It is the courage to continue that counts! -- 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] Amazon - ispasswordvalid() implementation
i think we need to form suffix array of the given string with one extra information tht is frm which index we are considerin suffix then sort those uffixe pointres after tht single scan wud do the job thanks rajat ahuja On Wed, Jun 29, 2011 at 10:23 PM, Swathi chukka.swa...@gmail.com wrote: Write the implementation of isPasswordValid() function which return true if the following conditions matches 1) If password length is between 5 to 12 characters 2) It should be alpha numerics 3) There should not be any consecutive substrings ex - ab12abc [valid as there are no consecutive substrings] ex - ab12abcabc [not valid as abc is consecutive substring]. Can someone provide the pseudo code with the logic.. Thanks, Swathi -- 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] Dp problem
You have to paint N boards of length {B1, B2, B3… BN}. There are K painters available and you are also given how much time a painter takes to paint 1 unit of board. You have to get this job done as soon as possible under the constraints that any painter will only paint continuous sections of board, say board {2, 3, 4} or only board {1} or nothing but not board {2, 4, 5}. -- 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] Dp problem
like u hav boards of length of length 7 2 6 9 4 and u hav 3 painters who can work ||ly so now one way to distribute is (7 )(2 6 9) (4) so time in ths case is 17 suppose we do (7 2)(6)(9 4) time in ths case is 13 or i can do (7 2)(6 9 )(4) time in ths case is 15 i m takin 1 unit time to paint one meter so it is directly equal to length so we hav to make time and ans is 13 On Mon, Apr 4, 2011 at 3:11 PM, Rakib Ansary Saikot ansaryfantas...@gmail.com wrote: I didnt quite get this problem. Sample case? On 4/4/11, rajat ahuja catch.rajatah...@gmail.com wrote: You have to paint N boards of length {B1, B2, B3… BN}. There are K painters available and you are also given how much time a painter takes to paint 1 unit of board. You have to get this job done as soon as possible under the constraints that any painter will only paint continuous sections of board, say board {2, 3, 4} or only board {1} or nothing but not board {2, 4, 5}. -- 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. -- Sent from my mobile device -- 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] Dp problem
then please share wid me yaar thanks in advance On Mon, Apr 4, 2011 at 4:30 PM, Manmeet Singh mans.aus...@gmail.com wrote: Simple Dp On Mon, Apr 4, 2011 at 3:33 PM, Munish Goyal munish.go...@gmail.comwrote: I think we can do it this way. Sum(all boards length) / K = A ( tentative avg. lenght to be painted by each painter) Now start from B1, and keep going further till Bi, till Sum(B1-Bi) is less than A. So this goes to painter P1. Same way for P2, start from i+1 till j. Condition: If i+1 itself is A. Then new A = length(B i+1). Keep going like this till Bn On Mon, Apr 4, 2011 at 3:20 PM, rajat ahuja catch.rajatah...@gmail.comwrote: like u hav boards of length of length 7 2 6 9 4 and u hav 3 painters who can work ||ly so now one way to distribute is (7 )(2 6 9) (4) so time in ths case is 17 suppose we do (7 2)(6)(9 4) time in ths case is 13 or i can do (7 2)(6 9 )(4) time in ths case is 15 i m takin 1 unit time to paint one meter so it is directly equal to length so we hav to make time and ans is 13 On Mon, Apr 4, 2011 at 3:11 PM, Rakib Ansary Saikot ansaryfantas...@gmail.com wrote: I didnt quite get this problem. Sample case? On 4/4/11, rajat ahuja catch.rajatah...@gmail.com wrote: You have to paint N boards of length {B1, B2, B3… BN}. There are K painters available and you are also given how much time a painter takes to paint 1 unit of board. You have to get this job done as soon as possible under the constraints that any painter will only paint continuous sections of board, say board {2, 3, 4} or only board {1} or nothing but not board {2, 4, 5}. -- 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. -- Sent from my mobile device -- 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. -- Munish -- 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]
Given 3 strings of only lowercase letter you have to count the number of ways you can construct the third string by combining two subsequences from the first two strings. After deleting 0 or more characters from a string we can get its subsequence. For example “a”, “b”, “c”, “ab”, “ac”, “bc” and “abc” all the strings are the subsequences of “abc”. A subsequence may also be empty. Now suppose there are two subsequences “abc” and “de”. By combining them you can get the following strings “abcde”, “abdce”, “abdec”, “adbce”, “adbec”, “adebc”, “dabce”, “dabec”, “daebc” and “deabc”. *Input* The first line of the input contains a single integer T (0T271) indicating the number of test cases. Each test case contains 3 strings containing only lowercase characters. The lengths of the strings are between 1 and 60. *Output* For each test case output a single integer denoting the number of ways you can construct the third string from the first two string by the above way. The result may be very large. You should output the result%10007. *Sample Input Output for Sample Input* *2* *abc** abc abc* *abbcd** bccde abcde* * * *8* *18* * * -- 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] what will be the output
12 and f(1,2) On Sat, Feb 5, 2011 at 12:46 AM, priya mehta priya.mehta...@gmail.comwrote: #include stdio.h #define f(a,b) a*##*b #define g(a) *#*a #define h(a) g(a) *int* main() { printf(%s\n,h(f(1,2))); printf(%s\n,g(f(1,2))); *return* 0; } -- 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.comalgogeeks%2bunsubscr...@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] what will be the output
ohk i try to xplain , first u understand abt two macros operator # operator makes string like #define g(a) *#*a WTEVER value of a will come ,this operator wil convert that into string noe 2nd operator is concatenation one like #define f(a,b) a*##*b here a and b wil get concatenated to form string but ths question test also the order of evalaution of fucntion like h(f(1,2)) first h macro wil get called and then it wil become g(f(1,2)) but now it wil call f(1,2) macro so tht makes g(12) n now g macro makes it 12 fr 2nd part g(f(1,2)) it calls g macro n converts it into string f(1,2) so here f macor wil nt get called as it has convereted into string :) cheers On Sat, Feb 5, 2011 at 12:50 AM, priya mehta priya.mehta...@gmail.comwrote: thats amazing :) :) but i wanted to know the explanation dear. On Sat, Feb 5, 2011 at 12:49 AM, rajat ahuja catch.rajatah...@gmail.comwrote: 12 and f(1,2) On Sat, Feb 5, 2011 at 12:46 AM, priya mehta priya.mehta...@gmail.comwrote: #include stdio.h #define f(a,b) a*##*b #define g(a) *#*a #define h(a) g(a) *int* main() { printf(%s\n,h(f(1,2))); printf(%s\n,g(f(1,2))); *return* 0; } -- 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.comalgogeeks%2bunsubscr...@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.comalgogeeks%2bunsubscr...@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.comalgogeeks%2bunsubscr...@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] Re: difference x
nyone like to post solution of ths problem, On Wed, Dec 22, 2010 at 10:28 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: saurabh , asking for a better sol. is not a crime. rest everybody is intelligent. On Wed, Dec 22, 2010 at 10:27 PM, Saurabh Koar saurabhkoar...@gmail.com wrote: @Snehal: I hv no problem wid ur doubts.Bt sometimes u post probs which r very basic.As u solved the looping prob in other thread I think u r intelligent enough to solve this prob(difference x) easily and also some other probs posted by u(not all).Some problems posted by u are really very tricky and I loved them.I jst requested u while posting if u review the ques carefully it will be helpful.I dint want to hurt u.If u r I m sorry.Bt still I will request u to post carefully.Lets finish this.And sorry once again. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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: difference x
saurabh .. i would like to know your solution can u please tell me ,, i want to know On Wed, Dec 22, 2010 at 11:50 PM, juver++ avpostni...@gmail.com wrote: Please don't use abbreviated words in your posts. Speak in pure English. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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] Delete vs Free
yup callin destructor ,, deallocate memory of resources allocated by object like heap memory of pointer ,, On Sun, Aug 15, 2010 at 3:58 PM, amit amitjaspal...@gmail.com wrote: I have read that Delete is more safer than free as Delete calls the destructor of the object but i dont get whats the reason for calling the destructor if anyways it want to deallocate the memory. Does calling the destructor serves any other purpose?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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] 23 candies among 7 kids
x1+x2+x3+x4+x5+x6+x7=23,,, noe no of solution is,,, of equation is,, n+r-1C(COMBINATION )r-1 (n identical items to be distributed into R grups) so ,, ans 23+7-1c7-1;(identical) if unidentical case, then each each cholate wud hav 7 options,, so ,, ans -- 7^23 (different) On Tue, Jun 22, 2010 at 8:22 PM, Aarthi Thangamani aarthi.thangam...@gmail.com wrote: Given 23 chocolates and there are 7 kids. How many ways are there to spilt the chocolates among the 7 kids? All of the chocolates must be distributed and it can happen that some kids do not get any. For example: first kid gets 23 chocolates and rest get none is one possibility. First 6 kids get one each and the 7th kid gets 17 chocolates is another possibility. How many such ways are there to distribute? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.