```kotlin fun rotateRight(head: ListNode?, k: Int): ListNode? { if (head?.next == null) return head
var num = 0 var current = head var previous : ListNode? = head while (previous?.next!=null){ num++ previous = previous.next } num++ previous?.next = current val step = num-k%num for (i in 1..step){ previous = current current = current?.next } previous?.next = null return current }