Skip to content

Commit dd64a67

Browse files
adding 59
1 parent de464a5 commit dd64a67

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,3 +2151,55 @@ const highestDigit = (number) => {
21512151
21522152
---
21532153
**[⬆ Back to Top](#header)**
2154+
2155+
2156+
2157+
##### 59. Given an array of scrabble tiles, create a function that outputs the maximum possible score a player can achieve by summing up the total number of points for all the tiles in their hand. Each hand contains 7 scrabble tiles.
2158+
2159+
2160+
```js
2161+
function maximumScore(titleHand){
2162+
//Write Your solution Here
2163+
};
2164+
2165+
2166+
console.log(maximumScore([
2167+
{ tile: "B", score: 2 },
2168+
{ tile: "V", score: 4 },
2169+
{ tile: "F", score: 4 },
2170+
{ tile: "U", score: 1 },
2171+
{ tile: "D", score: 2 },
2172+
{ tile: "O", score: 1 },
2173+
{ tile: "U", score: 1 }
2174+
])); // 15
2175+
2176+
2177+
console.log(maximumScore([
2178+
{ tile: "N", score: 1 },
2179+
{ tile: "K", score: 5 },
2180+
{ tile: "Z", score: 10 },
2181+
{ tile: "X", score: 8 },
2182+
{ tile: "D", score: 2 },
2183+
{ tile: "A", score: 1 },
2184+
{ tile: "E", score: 1 }
2185+
])); // 28
2186+
2187+
2188+
```
2189+
2190+
<details><summary style="cursor:pointer">Solution</summary>
2191+
2192+
```js
2193+
const maximumScore = (titleHand) => {
2194+
let maxScore = 0
2195+
for (i in titleHand){
2196+
maxScore += titleHand[i].score;
2197+
}
2198+
return maxScore;
2199+
}
2200+
```
2201+
2202+
</details>
2203+
2204+
---
2205+
**[⬆ Back to Top](#header)**

0 commit comments

Comments
 (0)