Skip to content

Commit aebcef1

Browse files
committed
Runtime: 2285 ms (Top 7.06%) | Memory: 48.4 MB (Top 63.13%)
1 parent 950c00f commit aebcef1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1+
// Runtime: 2285 ms (Top 7.06%) | Memory: 48.4 MB (Top 63.13%)
12

23
var invalidTransactions = function(transactions) {
34
const invalid = new Uint8Array(transactions.length).fill(false);
4-
5+
56
for(let i = 0; i < transactions.length; i++){
67
const [name, time, amount, city] = transactions[i].split(',');
7-
8+
89
if(+amount > 1000) invalid[i] = true;
9-
10-
for(let j = i + 1; j < transactions.length; j++){
10+
11+
for(let j = i + 1; j < transactions.length; j++){
1112
const [name1, time1, amount1, city1] = transactions[j].split(',');
12-
13+
1314
if(Math.abs(+time - +time1) <= 60 && name === name1 && city !== city1){
14-
invalid[i] = true;
15+
invalid[i] = true;
1516
invalid[j] = true;
1617
}
1718
}
1819
}
19-
20+
2021
return invalid.reduce((acc, val, index) => {
2122
if(val) acc.push(transactions[index])
2223
return acc;
2324
}, [])
2425
};
25-

0 commit comments

Comments
 (0)