Вот код (в Java)-< /p>
Код: Выделить всё
class Solution {
public ListNode sortList(ListNode head) {
return bubbleSort(head,size(head)-1,0);
}
int size(ListNode head){
int c=0;
while(head!=null){
c++;
head=head.next;
}
return c;
}
ListNode point(ListNode head,int index){
for(int i=0;i
Подробнее здесь: [url]https://stackoverflow.com/questions/75743647/my-solution-of-a-leetcode-problem-giving-stack-overflow-error-there-but-working[/url]