TheRealSamuel/LeetCodeProblem
0574
1{2 "id": 2684,3 "name": "determine_the_winner_of_a_bowling_game",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/determine-the-winner-of-a-bowling-game/",6 "date": "1682208000000",7 "task_description": "You are given two **0-indexed** integer arrays `player1` and `player2`, representing the number of pins that player 1 and player 2 hit in a bowling game, respectively. The bowling game consists of `n` turns, and the number of pins in each turn is exactly 10. Assume a player hits `xi` pins in the ith turn. The value of the ith turn for the player is: `2xi` if the player hits 10 pins in either (i - 1)th or (i - 2)th turn. Otherwise, it is `xi`. The **score** of the player is the sum of the values of their `n` turns. Return 1 if the score of player 1 is more than the score of player 2, 2 if the score of player 2 is more than the score of player 1, and 0 in case of a draw. **Example 1:** **Input:** player1 = [5,10,3,2], player2 = [6,5,7,3] **Output:** 1 **Explanation:** The score of player 1 is 5 + 10 + 2*3 + 2*2 = 25. The score of player 2 is 6 + 5 + 7 + 3 = 21. **Example 2:** **Input:** player1 = [3,5,7,6], player2 = [8,10,10,2] **Output:** 2 **Explanation:** The score of player 1 is 3 + 5 + 7 + 6 = 21. The score of player 2 is 8 + 10 + 2*10 + 2*2 = 42. **Example 3:** **Input:** player1 = [2,3], player2 = [4,1] **Output:** 0 **Explanation:** The score of player1 is 2 + 3 = 5. The score of player2 is 4 + 1 = 5. **Example 4:** **Input:** player1 = [1,1,1,10,10,10,10], player2 = [10,10,10,10,1,1,1] **Output:** 2 **Explanation:** The score of player1 is 1 + 1 + 1 + 10 + 2*10 + 2*10 + 2*10 = 73. The score of player2 is 10 + 2*10 + 2*10 + 2*10 + 2*1 + 2*1 + 1 = 75. **Constraints:** `n == player1.length == player2.length` `1 <= n <= 1000` `0 <= player1[i], player2[i] <= 10`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "player1 = [5,10,3,2], player2 = [6,5,7,3]",12 "output": "1 "13 },14 {15 "label": "Example 2",16 "input": "player1 = [3,5,7,6], player2 = [8,10,10,2]",17 "output": "2 "18 },19 {20 "label": "Example 3",21 "input": "player1 = [2,3], player2 = [4,1]",22 "output": "0 "23 },24 {25 "label": "Example 4",26 "input": "player1 = [1,1,1,10,10,10,10], player2 = [10,10,10,10,1,1,1]",27 "output": "2 "28 }29 ],30 "private_test_cases": [31 {32 "input": [33 [34 7,35 6,36 4,37 2,38 8,39 2,40 1,41 3,42 7,43 5,44 2,45 1,46 10,47 4,48 3,49 6,50 2,51 4,52 6,53 8,54 6,55 1,56 2,57 1,58 7,59 1,60 6,61 8,62 4,63 8,64 9,65 9,66 3,67 1,68 8,69 0,70 0,71 1,72 1,73 4,74 6,75 1,76 1,77 2,78 8,79 2,80 0,81 3,82 2,83 0,84 6,85 6,86 8,87 2,88 5,89 4,90 10,91 0,92 0,93 1,94 0,95 5,96 1,97 5,98 4,99 7,100 0,101 6,102 7,103 7,104 10,105 10,106 7,107 9,108 9,109 0,110 2,111 8,112 3,113 9,114 9,115 0,116 4,117 9,118 1,119 7,120 8,121 3,122 1,123 2,124 1,125 8,126 10,127 2,128 8,129 7,130 0,131 7,132 1,133 6,134 9,135 3,136 1,137 9,138 3,139 9,140 1,141 8,142 2,143 8,144 6,145 0,146 5,147 2,148 3,149 5,150 1,151 7,152 2,153 6,154 5,155 4,156 5,157 4,158 0,159 4,160 8,161 2,162 5,163 3,164 2,165 10,166 1,167 0,168 10,169 9,170 5,171 2,172 6,173 0,174 5,175 6,176 10,177 8,178 9,179 7,180 3,181 0,182 3,183 10,184 8,185 2,186 0,187 0,188 0,189 1,190 2,191 6,192 9,193 0,194 4,195 1,196 2,197 0,198 7,199 5,200 4,201 0,202 5,203 1,204 2,205 2,206 1,207 0,208 6,209 1,210 5,211 3,212 10,213 8,214 8,215 7,216 7,217 5,218 0,219 1,220 8,221 6,222 7,223 5,224 2,225 9,226 4,227 7,228 2,229 4,230 2,231 9,232 9,233 3,234 4,235 8,236 1,237 8,238 5,239 10,240 0,241 2,242 5,243 3,244 6,245 6,246 6,247 2,248 4,249 8,250 7,251 5,252 8,253 4,254 0,255 5,256 3,257 6,258 5,259 4,260 3,261 5,262 8,263 9,264 8,265 1,266 7,267 5,268 3,269 10,270 6,271 0,272 10,273 7,274 8,275 3,276 9,277 3,278 5,279 10,280 4,281 8,282 1,283 7,284 1,285 2,286 4,287 9,288 2,289 6,290 3,291 0,292 3,293 2,294 4,295 9,296 4,297 7,298 7,299 6,300 2,301 5,302 10,303 0,304 3,305 8,306 5,307 0,308 0,309 8,310 9,311 8,312 1,313 5,314 2,315 9,316 2,317 0,318 7,319 3,320 2,321 4,322 2,323 5,324 0,325 0,326 4,327 1,328 1,329 9,330 6,331 10,332 5,333 1,334 0,335 9,336 3,337 2,338 10,339 0,340 3,341 7,342 3,343 8,344 10,345 1,346 10,347 0,348 0,349 9,350 10,351 3,352 7,353 2,354 2,355 3,356 1,357 5,358 2,359 0,360 7,361 5,362 8,363 2,364 9,365 0,366 10,367 0,368 6,369 3,370 10,371 5,372 5,373 3,374 9,375 10,376 8,377 2,378 4,379 2,380 4,381 6,382 7,383 1,384 2,385 6,386 1,387 1,388 1,389 7,390 8,391 6,392 3,393 7,394 5,395 8,396 4,397 3,398 5,399 2,400 1,401 1,402 10,403 3,404 6,405 1,406 10,407 8,408 1,409 3,410 2,411 8,412 6,413 10,414 5,415 8,416 1,417 1,418 8,419 0,420 5,421 10,422 4,423 3,424 0,425 10,426 6,427 2,428 0,429 3,430 6,431 5,432 8,433 7,434 0,435 0,436 9,437 3,438 5,439 2,440 9,441 3,442 8,443 8,444 0,445 3,446 5,447 6,448 8,449 7,450 9,451 1,452 9,453 9,454 10,455 8,456 1,457 9,458 7,459 10,460 6,461 0,462 4,463 9,464 9,465 5,466 3,467 6,468 0,469 5,470 4,471 6,472 7,473 9,474 4,475 6,476 7,477 5,478 4,479 3,480 8,481 3,482 1,483 1,484 6,485 2,486 3,487 4,488 3,489 6,490 2,491 8,492 10,493 9,494 6,495 6,496 8,497 9,498 7,499 7,500 9,501 6,502 1,503 6,504 9,505 4,506 3,507 4,508 10,509 9,510 0,511 4,512 0,513 4,514 3,515 1,516 5,517 0,518 8,519 0,520 8,521 5,522 7,523 10,524 8,525 1,526 4,527 6,528 8,529 0,530 8,531 10,532 6,533 2,534 7,535 5,536 9,537 5,538 3,539 4,540 3,541 6,542 6,543 7,544 0,545 6,546 4,547 8,548 5,549 10,550 3,551 10,552 4,553 0,554 8,555 0,556 6,557 10,558 4,559 9,560 9,561 10,562 9,563 2,564 10,565 1,566 6,567 5,568 3,569 4,570 9,571 7,572 5,573 0,574 0,575 5,576 8,577 10,578 8,579 4,580 1,581 8,582 7,583 6,584 6,585 7,586 5,587 4,588 4,589 6,590 9,591 1,592 10,593 4,594 1,595 10,596 7,597 4,598 8,599 3,600 0,601 7,602 4,603 7,604 4,605 5,606 5,607 9,608 8,609 0,610 7,611 2,612 3,613 5,614 4,615 0,616 4,617 3,618 5,619 10,620 1,621 7,622 5,623 6,624 9,625 2,626 9,627 1,628 0,629 3,630 1,631 3,632 5,633 1,634 4,635 8,636 5,637 1,638 7,639 9,640 9,641 7,642 5,643 4,644 7,645 5,646 5,647 5,648 4,649 9,650 6,651 2,652 9,653 9,654 9,655 4,656 0,657 2,658 4,659 7,660 5,661 5,662 2,663 9,664 8,665 1,666 0,667 5,668 9,669 8,670 8,671 9,672 3,673 2,674 2,675 2,676 5,677 5,678 4,679 5,680 10,681 10,682 2,683 10,684 7,685 8,686 7,687 5,688 1,689 5,690 5,691 2,692 8,693 7,694 8,695 1,696 5,697 8,698 1,699 8,700 1,701 0,702 8,703 8,704 8,705 9,706 1,707 3,708 3,709 1,710 6,711 3,712 5,713 4,714 8,715 1,716 7,717 4,718 9,719 8,720 8,721 3,722 10,723 4,724 1,725 4,726 3,727 9,728 2,729 6,730 10,731 0,732 8,733 7,734 9,735 3,736 2,737 3,738 0,739 9,740 8,741 2,742 7,743 2,744 7,745 1,746 8,747 1,748 9,749 0,750 8,751 2,752 1,753 10,754 0,755 7,756 6,757 5,758 10,759 6,760 0,761 5,762 10,763 4,764 10,765 10,766 0,767 6,768 8,769 0,770 10,771 2,772 6,773 7,774 1,775 10,776 5,777 5,778 4,779 0,780 5,781 7,782 9,783 2,784 4,785 8,786 10,787 4,788 4,789 3,790 10,791 9,792 4,793 3,794 0,795 5,796 10,797 7,798 10,799 6,800 10,801 8,802 6,803 5,804 8,805 8,806 9807 ],808 [809 5,810 3,811 1,812 3,813 9,814 3,815 2,816 5,817 8,818 0,819 2,820 6,821 10,822 3,823 7,824 0,825 0,826 0,827 0,828 5,829 1,830 9,831 7,832 9,833 4,834 7,835 8,836 0,837 9,838 5,839 5,840 9,841 5,842 9,843 5,844 3,845 7,846 8,847 8,848 6,849 5,850 7,851 2,852 2,853 3,854 7,855 3,856 6,857 2,858 8,859 10,860 10,861 5,862 7,863 5,864 10,865 3,866 0,867 2,868 6,869 8,870 4,871 3,872 10,873 0,874 5,875 1,876 0,877 7,878 2,879 4,880 8,881 3,882 6,883 10,884 5,885 7,886 8,887 9,888 8,889 7,890 9,891 10,892 8,893 10,894 2,895 10,896 2,897 6,898 3,899 10,900 7,901 1,902 8,903 2,904 0,905 2,906 1,907 10,908 2,909 3,910 3,911 5,912 5,913 4,914 5,915 0,916 9,917 0,918 1,919 7,920 0,921 4,922 6,923 8,924 1,925 6,926 2,927 7,928 0,929 6,930 3,931 3,932 3,933 8,934 2,935 6,936 9,937 8,938 6,939 0,940 5,941 1,942 3,943 4,944 3,945 10,946 4,947 2,948 0,949 10,950 10,951 0,952 2,953 4,954 9,955 4,956 7,957 5,958 2,959 6,960 5,961 2,962 4,963 5,964 0,965 5,966 0,967 0,968 4,969 2,970 10,971 7,972 4,973 5,974 8,975 10,976 1,977 5,978 2,979 7,980 3,981 2,982 8,983 1,984 9,985 4,986 7,987 6,988 1,989 8,990 9,991 6,992 7,993 6,994 9,995 9,996 2,997 1,998 4,999 7,1000 3,1001 0,1002 5,1003 9,1004 8,1005 6,1006 4,1007 5,1008 10,1009 5,1010 1,1011 5,1012 9,1013 10,1014 10,1015 2,1016 9,1017 8,1018 7,1019 10,1020 2,1021 1,1022 8,1023 2,1024 6,1025 1,1026 1,1027 0,1028 5,1029 3,1030 0,1031 10,1032 1,1033 9,1034 4,1035 1,1036 10,1037 1,1038 3,1039 6,1040 0,1041 3,1042 3,1043 1,1044 10,1045 9,1046 5,1047 0,1048 8,1049 4,1050 0,1051 5,1052 3,1053 2,1054 10,1055 10,1056 10,1057 0,1058 6,1059 7,1060 3,1061 8,1062 10,1063 6,1064 9,1065 5,1066 0,1067 3,1068 6,1069 6,1070 4,1071 5,1072 3,1073 6,1074 6,1075 1,1076 6,1077 1,1078 2,1079 6,1080 4,1081 9,1082 6,1083 6,1084 0,1085 9,1086 6,1087 7,1088 9,1089 2,1090 7,1091 10,1092 0,1093 8,1094 8,1095 8,1096 10,1097 2,1098 3,1099 7,1100 1,1101 2,1102 7,1103 2,1104 5,1105 2,1106 0,1107 9,1108 10,1109 8,1110 2,1111 9,1112 1,1113 4,1114 1,1115 4,1116 8,1117 5,1118 10,1119 3,1120 8,1121 10,1122 5,1123 10,1124 2,1125 2,1126 7,1127 0,1128 0,1129 5,1130 0,1131 10,1132 4,1133 0,1134 0,1135 2,1136 6,1137 8,1138 8,1139 10,1140 2,1141 8,1142 0,1143 1,1144 8,1145 2,1146 10,1147 8,1148 5,1149 2,1150 7,1151 1,1152 8,1153 9,1154 3,1155 1,1156 1,1157 2,1158 0,1159 9,1160 0,1161 3,1162 5,1163 2,1164 7,1165 0,1166 8,1167 2,1168 9,1169 2,1170 1,1171 8,1172 3,1173 2,1174 6,1175 4,1176 5,1177 0,1178 5,1179 0,1180 1,1181 5,1182 4,1183 0,1184 10,1185 6,1186 6,1187 4,1188 1,1189 8,1190 5,1191 7,1192 8,1193 0,1194 3,1195 8,1196 0,1197 7,1198 10,1199 8,1200 5,