/* ************************************************************************** */ /* */ /* ::: o_ :::::: ::: */ /* put_at_index_asc.c :+: / :+::+: :+: */ /* +:+ > +:++:+ +:+ */ /* By: whaffman +#+ +:+ +#++#++:++#++ */ /* +#+ +#+#+ +#++#+ +#+ \o/ */ /* Created: 2024/11/24 15:16:18 by whaffman #+#+# #+#+# #+# #+# | */ /* Updated: 2024/11/24 15:16:19 by whaffman ### ### ### ### / \ */ /* */ /* ************************************************************************** */ #include "push_swap.h" #include "libft.h" int put_at_index_asc(int number, t_list *stack) { const int i = index_of(stack_min(stack), stack); const int size = ft_lstsize(stack); const int gt = count_gt(number, stack); return ((i + gt) % size); }