Coding-ninjas-data-st.-through-java icon indicating copy to clipboard operation
Coding-ninjas-data-st.-through-java copied to clipboard

Results 10 Coding-ninjas-data-st.-through-java issues
Sort by recently updated
recently updated
newest added

I have made the necessary changes....please have a look and approve it:)

current code is giving error, modified code is working perfectly

The previous code have an error in it. so please check the new code

Old code was giving runtime error in test case 3

Less lines of code,passed all the test cases. I think better than previous solution in time complexsity.

if( head==null ){ // base case1 return head; } if( i==j ){ // base case 2 return head; }

public class Solution { public static LinkedListNode swap_nodes(LinkedListNode head,int i,int j) { if(head==null){ // base case 1 return head; } if(i==j){ // base case 2 return head; } LinkedListNode temp=head,prev=null,c1=null,c2=null,p1=null,p2=null;...