We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c068468 commit 9c778d6Copy full SHA for 9c778d6
1 file changed
ALGORITHMS/스트리밍.js
@@ -0,0 +1,30 @@
1
+// 효율성 불통
2
+function solution(playList, time) {
3
+ const pLen = playList.length;
4
+
5
+ const addList = playList.concat(playList);
6
7
+ const getCount = (start, end) => {
8
+ let acc = 0,
9
+ count = 0;
10
+ addList.some((p) => {
11
+ acc += p;
12
+ if (acc > start) count++;
13
14
+ if (acc >= end) return true;
15
+ });
16
17
+ return count;
18
+ };
19
20
+ const sum = playList.reduce((acc, cur) => acc + cur, 0);
21
+ if (sum < time) return pLen;
22
23
+ let result = 0;
24
+ Array.from({ length: sum }).some((_, i) => {
25
+ const res = getCount(i, i + time);
26
+ if (res > result) result = res;
27
28
29
+ return result;
30
+}
0 commit comments