-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap_lst.c
41 lines (36 loc) · 1.21 KB
/
push_swap_lst.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap_lst.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mokhan <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/22 15:19:35 by mokhan #+# #+# */
/* Updated: 2023/12/22 15:19:36 by mokhan ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int ps_lstmin(t_stack *lst)
{
int min;
min = 2147483647;
while (lst != NULL)
{
if (lst->i < min)
min = lst->i;
lst = lst->nxt;
}
return (min);
}
int ps_lstmax(t_stack *lst)
{
int max;
max = -2147483648;
while (lst != NULL)
{
if (lst->i > max)
max = lst->i;
lst = lst->nxt;
}
return (max);
}