Company: Goldman Sachs_30oct
Difficulty: medium
Game of Book Cricket Problem Description The Game of Book Cricket is played by 2 players. Each player randomly opens the book and as you open the pages you score runs. The last digit of the even numbered page corresponds to your score. So if you opened page number 236, your score is 6. Hence possible scores are either 0, 2, 4, 6 or 8. However if the number ends with a 0 or 8, you are out and you lose your turn. Every time you open the book, note the score and keep on adding. So if you opened pages 124, 56, 22 your score is 4 + 6 + 2 = 12. Given that player 1 has scored N(totalScore) runs and the number of pages in the book is only 10, your task is to identify the number of ways you can match the score and remain not out. class Result { /* * Complete the 'noOfWaysToDrawTheGame' function below. * * The function is expected to return an INTEGER. * The function accepts INTEGER totalScore as parameter. */ public static int noOfWaysToDrawTheGame(int totalScore) { // Write your code here } }