Movatterモバイル変換


[0]ホーム

URL:


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

Commiteb5fdc7

Browse files
authored
Improved tasks 68, 69, 77
1 parent9f7d77c commiteb5fdc7

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‎

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

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

Lines changed: 41 additions & 17 deletions
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‎

Lines changed: 8 additions & 1 deletion
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)

[8]ページ先頭

©2009-2025 Movatter.jp