Insert a node at a specific position in a linked list
Insert a node at a specific position in a linked list
+ 14 comments In the Java code there is a compilation error when I simply return a null.
Solution.java:78: error: Illegal static declaration in inner class Solution.Result public static SinglyLinkedListNode insertNodeAtPosition(SinglyLinkedListNode llist, int data, int position) { ^ modifier 'static' is only allowed in constant variable declarations Solution.java:109: error: cannot find symbol SinglyLinkedListNode llist_head = insertNodeAtPosition(llist.head, data, position); ^ symbol: method insertNodeAtPosition(SinglyLinkedListNode,int,int) location: class Solution 2 errors
+ 15 comments Hey guys is there is any problem in test case. I think there is problem in the 2 4 because for that atleast we require 3 node . and if i am correct then please correct the input as soon as possible
+ 5 comments This is NOT a properly designed test case. Output is getting swapped when linked list starts with 2. Dont waste your time on this question.
+ 2 comments Either the test case that the author has included is broken or they have incorrectly described the test data and how the function should work. I was only able to pass it by including some special case code to get rid of a head node with data=2 and insert a tail node with a data=2. This challenge should be deleted until the author can fix the issues.
+ 4 comments Can somebody help me with this error in java 8 ?
Solution.java:78: error: Illegal static declaration in inner class Solution.Result public static SinglyLinkedListNode insertNodeAtPosition(SinglyLinkedListNode llist, int data, int position) { ^ modifier 'static' is only allowed in constant variable declarations Solution.java:121: error: cannot find symbol SinglyLinkedListNode llist_head = insertNodeAtPosition(llist.head, data, position); ^ symbol: method insertNodeAtPosition(SinglyLinkedListNode,int,int) location: class Solution 2 errors
Sort 1306 Discussions, By:
Please Login in order to post a comment