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

Appearance settings

Commit c79ba7c

Browse filesBrowse files
committed
61st problem
1 parent a3f7f20 commit c79ba7c
Copy full SHA for c79ba7c

File tree

2 files changed

+17
-0
lines changed
Filter options

2 files changed

+17
-0
lines changed

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

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
var lengthOfLastWord = function(s) {
2+
s = s.trim()
3+
return s.length - s.lastIndexOf(" ") -1
4+
};

‎61-70/61. Rotate List.js

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var rotateRight = function(head, k) {
2+
let o = new ListNode(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(let i = 0 ; i < a.length ;i++){
10+
o = o.next = new ListNode(a[i])
11+
}
12+
return ans.next
13+
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.