@piyush : thanks i thot most significant bit was take as fisrt figure . On Wed, Jul 6, 2011 at 1:03 AM, Piyush Kapoor <pkjee2...@gmail.com> wrote:
> 7 occurs 1 time... > so 8th digit is 1 > > On Wed, Jul 6, 2011 at 1:02 AM, aditya kumar <aditya.kumar130...@gmail.com > > wrote: > >> in 70000000 : '0' occurs seven times and rst of the numbers occur zero >> times. i still dint get where i am wrong . plz explain me . >> >> >> On Wed, Jul 6, 2011 at 12:47 AM, L <prnk.bhatna...@gmail.com> wrote: >> >>> @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is >>> it 0? >>> >>> Please take a moment before posting your solution, and think whether >>> it is write or wrong! >>> >>> On Jul 6, 12:11 am, aditya kumar <aditya.kumar130...@gmail.com> wrote: >>> > Q3. ans:70000000 i guess this is also a correct answer and no unique >>> soln as >>> > such >>> > >>> > On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar >>> > <aditya.kumar130...@gmail.com>wrote: >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > > boolean palindromeCheck(String string) >>> > > { >>> > > len=string.length(); >>> > > if((string.length()>1)) >>> > > { >>> > > if((string.charAt(0)==string.charAt(len-1))) >>> > > { >>> > > str=""; >>> > > str=str+string.substring(1,(len-1)); >>> > > palindromeCheck(str); >>> > > } >>> > > else >>> > > { >>> > > flag=false; >>> > > } >>> > > } >>> > > return flag; >>> > > } >>> > >>> > > THis also works fine if you dont want to use pointer >>> > >>> > > On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain <azhar...@gmail.com> >>> wrote: >>> > >>> > >> For Q4: I think this is the optimal code >>> > >>> > >> int recurPalin(char *start, char *end) >>> > >> { >>> > >> if (end < start) >>> > >> return true; >>> > >>> > >> if (*start != *end) >>> > >> return false; >>> > >>> > >> return recurPalin(start+1, end-1); >>> > >> } >>> > >>> > >> - >>> > >> Azhar. >>> > >>> > >> On Tue, Jul 5, 2011 at 12:21 PM, vikas <mehta...@gmail.com> wrote: >>> > >>> > >>> My program for Q4. >>> > >>> // recursively find if a given string is palindrome >>> > >>> bool IsPalindrome(string s, int start, int start2, bool >>> flag) >>> > >>> { >>> > >>> bool flag1 = flag; >>> > >>> if (start >= 0 && start2 < (s.Length)) >>> > >>> { >>> > >>> char c1 = s[start]; >>> > >>> char c2 = s[start2]; >>> > >>> if (c1.Equals(c2)) >>> > >>> { >>> > >>> if (start == 0 && start2 == s.Length - 1) { >>> flag = >>> > >>> true; } >>> > >>> if (IsPalindrome(s, start - 1, start2 + 1, >>> flag)) >>> > >>> { >>> > >>> flag1 = true; >>> > >>> } >>> > >>> } >>> > >>> } >>> > >>> return flag1; >>> > >>> } >>> > >>> > >>> while calling >>> > >>> if (s.Length % 2 != 0) >>> > >>> { >>> > >>> p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + >>> 1, >>> > >>> false); >>> > >>> } >>> > >>> else >>> > >>> { >>> > >>> p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, >>> false); >>> > >>> > >>> } >>> > >>> > >>> -- >>> > >>> 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/-/I6SVTB0o-uUJ. >>> > >>> > >>> 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. >>> >>> >> -- >> 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. >> > > > > -- > *Regards,* > *Piyush Kapoor,* > *CSE-IT-BHU* > > -- > 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.