Task 5 is done
This commit is contained in:
parent
cd08e7ba3a
commit
31810f5090
18 changed files with 563 additions and 1 deletions
27
2025.05.23/05Ex/solve.c
Normal file
27
2025.05.23/05Ex/solve.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include "solve.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int t5_solve (node *head)
|
||||
{
|
||||
char *last = head->string;
|
||||
int maximum = 1, count = 1;
|
||||
|
||||
for (head = head->next; head; head = head->next)
|
||||
{
|
||||
if (strcmp(head->string, last) > 0)
|
||||
count++;
|
||||
else {
|
||||
if (maximum < count)
|
||||
maximum = count;
|
||||
|
||||
count = 1;
|
||||
}
|
||||
|
||||
last = head->string;
|
||||
}
|
||||
|
||||
return maximum;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue