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

Commita33e3fe

Browse files
authored
Merge pull request#1 from Tahirc1/code-add
58th and 61st problem
2 parentsa3f7f20 +c79ba7c commita33e3fe

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

‎51-60/58. Length of Last Word.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
varlengthOfLastWord=function(s){
2+
s=s.trim()
3+
returns.length-s.lastIndexOf(" ")-1
4+
};

‎61-70/61. Rotate List.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
varrotateRight=function(head,k){
2+
leto=newListNode(0)
3+
let[ans,a]=[o,[]]
4+
while(head!=null){
5+
a.push(head.val)
6+
head=head.next
7+
}
8+
a.unshift(...a.splice(a.length-k%a.length))
9+
for(leti=0;i<a.length;i++){
10+
o=o.next=newListNode(a[i])
11+
}
12+
returnans.next
13+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp