Skip to content

Commit 82aace9

Browse files
BarklimBarklim
authored andcommitted
Create 0066.js
1 parent 2703152 commit 82aace9

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

0066-plus-one.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ var plusOne = function(digits) {
3939
var plusOne = function(digits) {
4040
return String(BigInt(digits.join('')) + BigInt(1)).split('');
4141
};
42+
43+
// var plusOne = function(digits) {
44+
// return String(parseInt(digits.join('')) + 1).split('');
45+
// };
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @param {number[]} digits
3+
* @return {number[]}
4+
*/
5+
var plusOne = function(digits) {
6+
7+
};
8+
9+
const example1 = plusOne([1,2,3]); // [1,2,4]
10+
const example2 = plusOne([4,3,2,1]); // [4,3,2,2]
11+
const example3 = plusOne([9]); // [1,0]
12+
const example4 = plusOne([1,9,9]); // [2,0,0]
13+
14+
console.log(example1);
15+
console.log(example2);
16+
console.log(example3);
17+
console.log(example4);
18+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @param {string} s
3+
* @return {boolean}
4+
*/
5+
var repeatedSubstringPattern = function(s) {
6+
7+
};
8+
9+
const example1 = repeatedSubstringPattern("abab"); // true
10+
const example2 = repeatedSubstringPattern("aba"); // false
11+
const example3 = repeatedSubstringPattern("abcabcabcabc"); // true
12+
const example4 = repeatedSubstringPattern("121"); // false
13+
const example5 = repeatedSubstringPattern("123123"); // true
14+
15+
console.log(example1);
16+
console.log(example2);
17+
console.log(example3);
18+
console.log(example4);
19+
console.log(example5);
20+
21+
// var repeatedSubstringPattern = function(s) {
22+
// return (s + s).slice(1, s.length * 2 - 1).indexOf(s) !== -1
23+
// };
24+
25+
// var repeatedSubstringPattern = function(s) {
26+
// const n = s.length;
27+
28+
// for (let i = 1; i <= Math.floor(n / 2); i++) {
29+
// if (n % i === 0 && s.slice(0, i).repeat(n / i) === s) {
30+
// return true;
31+
// }
32+
// }
33+
34+
// return false;
35+
// };

example/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,6 @@ Better order to solve problems
207207

208208
1768. Merge Strings Alternately
209209
389. Find the Difference
210-
28. Find the Index of the First Occurrence in a String
210+
28. Find the Index of the First Occurrence in a String
211+
459. Repeated Substring Pattern
212+
66. Plus One

0 commit comments

Comments
 (0)