You are viewing a single comment's thread. Return to all comments →
Hello I tried to solve this with kotlin cause Im Software android Engineer and I feel more familiar with kotlin
fun removeDuplicates(llist: SinglyLinkedListNode?): SinglyLinkedListNode? { var current = list while(current?.next != null){ if(current.data == current.next?.data){ current.next = current.next?.next }else{ current = current.next } } return list }
My logic is correct but Hacker rank has a kind of bug working with nulleables types the same logic in python works correctly why?
def removeDuplicates(llist): current = llist while current.next is not None: if current.data == current.next.data: current.next = current.next.next else: current = current.next return llist
Seems like cookies are disabled on this browser, please enable them to open this website
Delete duplicate-value nodes from a sorted linked list
You are viewing a single comment's thread. Return to all comments →
Hello I tried to solve this with kotlin cause Im Software android Engineer and I feel more familiar with kotlin
My logic is correct but Hacker rank has a kind of bug working with nulleables types the same logic in python works correctly why?