-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsocks.js
More file actions
47 lines (40 loc) · 961 Bytes
/
Copy pathsocks.js
File metadata and controls
47 lines (40 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const n = 9
const arr = [10, 20, 20, 10, 10, 30, 50, 10, 20]
function sockMerchant(n, ar) {
arr.map((a) => {
// console.log('a', a)
arr.map((b) => {
// console.log('b', b)
if (a === b) {
const count = 0
// count += 1
console.log('loop count:', count)
}
})
})
// return number of pairs of socks(matching numbers)
// console.log('count', count)
// return count
}
sockMerchant()
// function sockMerchant(n, ar) {
// for (a in arr) {
// console.log('a', a)
// for (b in arr) {
// console.log('b', b)
// }
// }
// // return number of pairs of socks(matching numbers)
// }
// sockMerchant()
// var isLeapYear = function (year) {
// return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)
// }
// var count = 0
// for (i = 2001; i < 3000; i++) {
// if (isLeapYear(i)) {
// count++
// console.log('count', count)
// }
// }
// console.log(isLeapYear())