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 a33e3fe

Browse filesBrowse files
authored
Merge pull request Tahirc1#1 from Tahirc1/code-add
58th and 61st problem
2 parents a3f7f20 + c79ba7c commit a33e3fe
Copy full SHA for a33e3fe

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.