We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9da00ee commit 15b826bCopy full SHA for 15b826b
bona1122/[week4]Hash/Memory_score.js
@@ -0,0 +1,8 @@
1
+const solution = (name, yearning, photo) => {
2
+ const map = name.reduce((map, name, idx) => {
3
+ map[name] = yearning[idx]
4
+ return map
5
+ }, {})
6
+
7
+ return photo.map((p) => p.reduce((acc, cur) => (acc += map[cur] || 0), 0))
8
+}
0 commit comments