jayparikh111
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
In Python, we can use set() to get answers.
a = [1,2,3,4,5,6,7]
b = [1,3,4,5,6,7]
print set(a) - set(b)
Comment hidden because of low score. Click to expand.
0
of 0 vote
Can you elaborate please ?
- jayparikh111 May 25, 2016Comment hidden because of low score. Click to expand.
0
of 0 vote
Hope this would help....
first find linked list length - n
startpointer = head
subtract_node = n // this variable used to store n-i iteration
for i = 1 to n/2 {
value = startpointer.value
lastpointer = startpointer
for j = i to (subtracted_node-i) {
lastpointer = lastpointer.next
}
lastvalue = lastpointer.value
startpointer.value = value - lastvalue
startpointer = startpointer.next
subtract_node = subtract_node - 1
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Python code
- jayparikh111 May 26, 2016