[algogeeks] Re: Puzzle Will Stuck
well its game of Number Theory There are 3 possibilities in any number set - prime numbers, non-prime numbers (that are not squares) squares. In this puzzle the original state of a door will be reversed if it is acted upon an odd number of times - otherwise the original state the final state will be the same. Now let us take each of the number types I mentioned above. its another Explanation How I will Approach to the Problem... 1. Prime numbers are divisible by themselves 1 - so they will be acted upon an even number of times. So these doors (corresponding to prime numbers) will be closed 2. Non-prime non-square numbers(15,27 etc) are divisible by themselves, 1, any other two numbers such as a*b where a is not equal to b. Thus they are divisible at least by 4 numbers - which means these doors will be closed as well. 3. Square numbers are divisible by themselves, 1 its factors a*a. Since the factors are the same, these numbers are divisible by at least 3 numbers - hence these doors will be open Correct me If I am wrong... Another Approach will b appreciated Thanks Regards Shashank Mani The best way to escape from a problem is to solve it. -- 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: Puzzle Will Stuck
Generalization algorithm for the 8 - queens classical chess problem On Jan 4, 5:43 am, bittu shashank7andr...@gmail.com wrote: There is a lock which is an N by N grid of switches. Each switch can be in one of two states (on/off). The lock is unlocked if all the switches are on. The lock is built in such a way that, if you toggle some switch, all the switches in its row and its column toggle too Give an algorithm which, given N and a configuration of the N^2 switches, will tell you whether the lock can be unlocked by a sequence of switch toggles Note 1: Can be done in O(N^2) time and O(1) space. Note 2: You just need to tell if a sequence which unlocks the lock exists (and not the actual sequence) -- 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: Puzzle Will Stuck
ankur is right this problem is similar to the problem of converting a matrix to zero matrix On Tue, Jan 4, 2011 at 8:36 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: how are they similar ? On Tue, Jan 4, 2011 at 8:31 PM, jennmeedo jennme...@gmail.com wrote: Generalization algorithm for the 8 - queens classical chess problem On Jan 4, 5:43 am, bittu shashank7andr...@gmail.com wrote: There is a lock which is an N by N grid of switches. Each switch can be in one of two states (on/off). The lock is unlocked if all the switches are on. The lock is built in such a way that, if you toggle some switch, all the switches in its row and its column toggle too Give an algorithm which, given N and a configuration of the N^2 switches, will tell you whether the lock can be unlocked by a sequence of switch toggles Note 1: Can be done in O(N^2) time and O(1) space. Note 2: You just need to tell if a sequence which unlocks the lock exists (and not the actual sequence) -- 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. -- Regards Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, Allahabad. -- 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.