Created
October 27, 2012 20:31
Revisions
-
Dheeraj revised this gist
Oct 27, 2012 . No changes.There are no files selected for viewing
-
Dheeraj revised this gist
Oct 27, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ 1. Why isn't the answer 1/4 for the first sample test case. ans: The trick lies in the space the input rests in. Its REAL numbers and not INTEGERS. So, the asnwer is 1/2 and not 1/4. 2. If a random number generates between 0 and M are 0 and M included does it affect my strategy if I assume either? ans: No! Real numbers have a limit of 0 at any integer value. Its always limiting. So, it doesn't matter if 0 and M are included or excluded. For clarity sake a random number generates a number in the range [0..M] -
Dheeraj revised this gist
Oct 27, 2012 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ 1. Output not matching ans: The answer is num%142857 and not just the nCr answer. 2. 142857 isn't a prime. Is it intentional? ans: Yes!! it is intentional. Some numbers are special and 142857 is one among them though it isn't a prime -
Dheeraj created this gist
Oct 27, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ 1. How is the third test case in the sample test case 1? ans: for the testcase 1 25, only 1 situation is possible. A Strike, A spare and an extra ball using which we can get a 5. 10 9 6 isn't a valid bowling score as for that frame, a strike in the first try and a 9 in the second try will leave 1 pin on the bowling alley and not 6. Hence only 1 valid case results in a score of 25. For more information on bowling scoring check https://en.wikipedia.org/wiki/Ten-pin_bowling#Rules_of_play This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ 1. Is the matrix symmetric? ans: Yes 2. Is the permutation transitive? ans: yes. Matrix serves as a checker for every permutation P starting from the initial permutation that one reads as the input. The same is clearly explained in the second sample test case. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ 1. Why isn't the answer 1/4 and 1/2 for the first sample test case. ans: The trick lies in the space the input rests in. Its REAL numbers and not INTEGERS. So, the asnwer is 1/2 and not 1/4. 2. If a random number generates between 0 and M are 0 and M included? Does it affect my strategy if I assume either? ans: No! Real numbers have a limit of 0 at any integer value. Its always limiting. So, it doesn't matter if 0 and M are included or excluded. For clarity sake a random number generates a number in the range [0..M]