Skip to content

Commit 0b70ae3

Browse files
committed
Improved tasks 68, 69, 77
1 parent 9f7d77c commit 0b70ae3

File tree

3 files changed

+51
-20
lines changed

3 files changed

+51
-20
lines changed

src/main/ts/g0001_0100/s0069_sqrtx/solution.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ function mySqrt(x: number): number {
88
while (low <= high) {
99
const mid = Math.floor((low + high) / 2)
1010
const pow = mid * mid
11-
if(pow > x) {
11+
if (pow > x) {
1212
high = mid - 1
13-
} else if(pow < x) {
13+
} else if (pow < x) {
1414
low = mid + 1
1515
lowest = mid
1616
} else {

src/test/ts/g0001_0100/s0068_text_justification/solution.test.ts

+41-17
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,51 @@ import { expect, test } from 'vitest'
44

55
test('fullJustify', () => {
66
expect(fullJustify(['This', 'is', 'an', 'example', 'of', 'text', 'justification.'], 16)).toEqual([
7-
'This is an',
8-
'example of text',
9-
'justification. '
10-
])
7+
'This is an',
8+
'example of text',
9+
'justification. ',
10+
])
1111
})
1212

1313
test('fullJustify2', () => {
14-
expect(fullJustify(['What','must','be','acknowledgment','shall','be'], 16)).toEqual([
15-
'What must be',
16-
'acknowledgment ',
17-
'shall be '
18-
])
14+
expect(fullJustify(['What', 'must', 'be', 'acknowledgment', 'shall', 'be'], 16)).toEqual([
15+
'What must be',
16+
'acknowledgment ',
17+
'shall be ',
18+
])
1919
})
2020

2121
test('fullJustify3', () => {
22-
expect(fullJustify(['Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do'], 20)).toEqual([
23-
'Science is what we',
24-
'understand well',
25-
'enough to explain to',
26-
'a computer. Art is',
27-
'everything else we',
28-
'do '
29-
])
22+
expect(
23+
fullJustify(
24+
[
25+
'Science',
26+
'is',
27+
'what',
28+
'we',
29+
'understand',
30+
'well',
31+
'enough',
32+
'to',
33+
'explain',
34+
'to',
35+
'a',
36+
'computer.',
37+
'Art',
38+
'is',
39+
'everything',
40+
'else',
41+
'we',
42+
'do',
43+
],
44+
20,
45+
),
46+
).toEqual([
47+
'Science is what we',
48+
'understand well',
49+
'enough to explain to',
50+
'a computer. Art is',
51+
'everything else we',
52+
'do ',
53+
])
3054
})

src/test/ts/g0001_0100/s0077_combinations/solution.test.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import { combine } from 'src/main/ts/g0001_0100/s0077_combinations/solution'
33
import { expect, test } from 'vitest'
44

55
test('combine', () => {
6-
expect(combine(4, 2)).toEqual([[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]])
6+
expect(combine(4, 2)).toEqual([
7+
[1, 2],
8+
[1, 3],
9+
[1, 4],
10+
[2, 3],
11+
[2, 4],
12+
[3, 4],
13+
])
714
})
815

916
test('combine2', () => {

0 commit comments

Comments
 (0)