We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 51557c9 + 1792d02 commit 36baf25Copy full SHA for 36baf25
1주차/김유경/같은 숫자는 싫어.js
@@ -0,0 +1,11 @@
1
+function solution(arr) {
2
+ const stack = [];
3
+
4
+ arr.forEach(number => {
5
+ if(stack.length && stack[stack.length-1] === number) {
6
+ stack.pop();
7
+ }
8
+ stack.push(number);
9
+ })
10
+ return stack;
11
+}
1주차/김유경/올바른 괄호.js
@@ -0,0 +1,21 @@
+function solution(s){
+ let answer = '';
+ for(let i=0, length = s.length; i < length; i++) {
+ const word = s[i];
+ if(i === 0) {
+ stack.push(word);
+ } else {
+ if(stack[stack.length-1] === '(' && word === ')') {
12
13
14
15
16
17
18
19
+ answer = stack.length === 0;
20
+ return answer;
21
0 commit comments