Skip to content

Instantly share code, notes, and snippets.

@dheerajrav
Created October 27, 2012 20:31
Show Gist options
  • Save dheerajrav/3966052 to your computer and use it in GitHub Desktop.
Save dheerajrav/3966052 to your computer and use it in GitHub Desktop.
FAQ cs3
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
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.
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
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]
@brarvind
Copy link

how is the ans for power outage qn for this test case 2 1 1000000 1 2 1000000 is 0 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment