FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JS-code/codility/src/script3.js at master · Vitaminvp/JS-code · GitHub
Vitaminvp
/
JS-code
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
30
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JS-code
/
codility
/
src
/
script3.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (20 loc) · 497 Bytes
Breadcrumbs
JS-code
/
codility
/
src
/
script3.js
Copy path
File metadata and controls
23 lines (20 loc) · 497 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function
solution
(
N
)
{
// write your code in JavaScript (Node.js 8.9.4)
const
obj
=
{
}
;
N
.
map
(
item
=>
{
if
(
obj
[
item
]
)
{
obj
[
item
]
=
obj
[
item
]
+
1
;
}
else
{
obj
[
item
]
=
1
;
}
}
)
;
console
.
log
(
"obj"
,
obj
)
;
for
(
let
key
in
obj
)
{
if
(
obj
[
key
]
%
2
)
return
key
;
}
return
-
1
;
}
let
A
=
[
9
,
3
,
9
,
3
,
9
,
7
,
9
]
;
let
B
=
[
1
,
3
,
9
,
3
,
9
,
7
,
9
,
7
,
7
,
6
,
9
,
6
,
1
,
2
]
;
console
.
log
(
"solution(A)"
,
solution
(
A
)
)
;
console
.
log
(
"solution(B)"
,
solution
(
B
)
)
;
Back
|
FazBrowse Home
|
New Git URL