2 parents 39cbde1 + b5decfe commit d372810Copy full SHA for d372810
2 files changed
leetcode3/정진영/242. Valid Anagram
@@ -0,0 +1,12 @@
1
+/**
2
+ * @param {string} s
3
+ * @param {string} t
4
+ * @return {boolean}
5
+ */
6
+var isAnagram = function(s, t) {
7
+ const a = s.split("").sort().join("");
8
+ const b = t.split("").sort().join("");
9
+
10
+ if (a == b) return true;
11
+ else return false;
12
+};
leetcode3/정진영/413. Arithmetic Slices
@@ -0,0 +1,21 @@
+ * @param {number[]} nums
+ * @return {number}
+var numberOfArithmeticSlices = function(nums) {
+ let count = 0;
+ let ans = 0;
+ if (nums.length <= 2) return 0;
+ for (let i = 2; i<nums.length; i++){
+ if ((nums[i] - nums[i-1]) == (nums[i-1] - nums[i-2])){
13
+ count++;
14
+ ans += count;
15
+ } else {
16
+ count = 0;
17
+ }
18
19
20
+ return ans;
21
0 commit comments