summaryrefslogtreecommitdiff
path: root/rushs/evalexpr/hill_array
diff options
context:
space:
mode:
Diffstat (limited to 'rushs/evalexpr/hill_array')
-rw-r--r--rushs/evalexpr/hill_array/hill_array.c43
-rw-r--r--rushs/evalexpr/hill_array/hill_array.h8
2 files changed, 0 insertions, 51 deletions
diff --git a/rushs/evalexpr/hill_array/hill_array.c b/rushs/evalexpr/hill_array/hill_array.c
deleted file mode 100644
index 14d3a85..0000000
--- a/rushs/evalexpr/hill_array/hill_array.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "hill_array.h"
-
-int top_of_the_hill(int tab[], size_t len)
-{
- if (len == 0)
- {
- return -1;
- }
-
- int top = 0;
- size_t i = 0;
-
- while (i + 1 < len && tab[i] <= tab[i + 1])
- {
- if (tab[i] < 0 || tab[i + 1] < 0)
- {
- return -1;
- }
- if (tab[i] != tab[i + 1])
- {
- top = i + 1;
- }
- i++;
- }
-
- while (i + 1 < len && tab[i] >= tab[i + 1])
- {
- if (tab[i] < 0 || tab[i + 1] < 0)
- {
- return -1;
- }
- i++;
- }
-
- if (i + 1 == len)
- {
- return top;
- }
- else
- {
- return -1;
- }
-}
diff --git a/rushs/evalexpr/hill_array/hill_array.h b/rushs/evalexpr/hill_array/hill_array.h
deleted file mode 100644
index 3152c19..0000000
--- a/rushs/evalexpr/hill_array/hill_array.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef HILL_ARRAY_H
-#define HILL_ARRAY_H
-
-#include <stddef.h>
-
-int top_of_the_hill(int tab[], size_t len);
-
-#endif /* !HILL_ARRAY_H */