Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c418ee9

Browse files
committed
fix: linter fixes, revision in eslint config
1 parent 3747071 commit c418ee9

File tree

9 files changed

+98
-69
lines changed

9 files changed

+98
-69
lines changed

‎.eslintrc.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"node": true,
44
"jest": true
55
},
6-
"extends": "airbnb-base"
6+
"extends": ["prettier", "airbnb-base"],
7+
"plugins": ["prettier"]
78
}

‎package-lock.json‎

Lines changed: 62 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
"devDependencies": {
1919
"eslint": "^5.11.1",
2020
"eslint-config-airbnb-base": "^13.1.0",
21+
"eslint-config-prettier": "^6.5.0",
2122
"eslint-plugin-import": "^2.14.0",
22-
"jest": "^25.0.0"
23+
"eslint-plugin-prettier": "^3.1.1",
24+
"jest": "^25.0.0",
25+
"prettier": "^1.19.1"
2326
}
2427
}

‎src/_Problems_/compose-largest-number/compose-largest.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Compose Largest Number', () => {
2222
});
2323
});
2424

25-
describe('Testing `compare()`', () => {
25+
describe('Testing custom `compare()` for `sort()`', () => {
2626
it('Should return [60, 548] instead of [548, 60]', () => {
2727
expect([60, 548].sort(compare)).toEqual([60, 548]);
2828
});
File renamed without changes.
File renamed without changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// FIND SUBSEQUENCE OF A GIVEN SUBSTRING
2+
// SUBSTRING OF 'abc' ---->>>> [ '', 'a', 'b', 'ab', 'c', 'ac', 'bc', 'abc' ]
3+
// SUBSTRING OF 'bc' ---->>>> ['', 'b', 'c', 'bc']
4+
// SUBSTRING OF 'c' ---->>>> ['', 'c']
5+
// A pattern can be noticed in above three substrings. Technique followed is recursion.
6+
// Time complexity : O(2^n) n is the length of the string provided.
7+
8+
function getSubesequence(str) {
9+
if (str.length === 0) {
10+
const array = [''];
11+
return array;
12+
}
13+
14+
const currentChar = str.charAt(0);
15+
const restOfString = str.substring(1);
16+
17+
const result = [];
18+
const returnResult = getSubesequence(restOfString);
19+
for (let i = 0; i < returnResult.length; i += 1) {
20+
result.push(returnResult[i]);
21+
result.push(currentChar + returnResult[i]);
22+
}
23+
return result;
24+
}
25+
26+
module.exports = {
27+
getSubesequence,
28+
};

‎src/_Problems_/get_subsequence/subsequence.test.js‎ renamed to ‎src/_Problems_/get-subsequence/subsequence.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { getSubesequence } = require('.');
22

33
describe('GetSubesequence', () => {
44
it('Sequence of abc', () => {
5-
expect(getSubesequence('abc').sort()).toEqual(['', 'a', 'ab', 'abc', 'ac', 'b', 'bc', 'c']);
5+
expect(getSubesequence('abc').sort()).toEqual(['', 'a', 'ab', 'abc', 'ac', 'b', 'bc', 'c']);
66
});
77

88
it('Sequence of bc', () => {

‎src/_Problems_/get_subsequence/index.js‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /