-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleetcode.py
More file actions
39 lines (32 loc) · 834 Bytes
/
leetcode.py
File metadata and controls
39 lines (32 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'''sentences=["alice and bob love leetcode","i think so too","this is great thanks very much"]
mcount=0
for sentence in sentences:
words=sentence.split()
count=len(words)
mcount=max(mcount,count)
print(count)'''
'''operations=["--x","x++","x++"]
x=0
for i in range(len(operations)):
if operations[i]=="x++" or operations[i]=="++x":
x=x+1
else:
x=x-1
print(x) '''
'''hours = [0,1,2,3,4]
target = 2
count=0
for i in range(len(hours)):
#count=0
if hours[i]>=target:
count+=1
print(count)'''
def revlist(self,head):
prev_node=None
current_node=head
while current_node!=None:
next_node=current_node.next
current_node.next=prev_node
prev_node=current_node
current_node=next_node
l=[1,2,3,4]