• + 1 comment

    Kotlin test cases where t > 1 fail because no newline is printed after each call to printDoublyLinkedList().

    Same for Insert Node at Specific Position.

    I think this would fix it (if main were editable) - see addition of println() at end.

    fun main(args: Array<String>) {
        val scan = Scanner(System.`in`)
    
        val t = scan.nextLine().trim().toInt()
    
        for (tItr in 1..t) {
            val llistCount = scan.nextLine().trim().toInt()
            val llist = DoublyLinkedList()
    
            for (i in 0 until llistCount) {
                val llist_item = scan.nextLine().trim().toInt()
                llist.insertNode(llist_item)
            }
    
            val llist1 = reverse(llist?.head)
    
            printDoublyLinkedList(llist1, " ")
    				
            // SHOULD INSERT NEWLINE HERE:
            println()
        }
    }
    

    Please fix this