simplify
This commit is contained in:
parent
68f61fb9e1
commit
eea7beb6e3
1 changed files with 8 additions and 12 deletions
|
@ -12,21 +12,17 @@ pub fn main() {
|
|||
|> io.debug
|
||||
}
|
||||
|
||||
type Direction {
|
||||
Increasing
|
||||
Decreasing
|
||||
}
|
||||
|
||||
fn is_safe_all_combo(list: List(Int)) -> Bool {
|
||||
case is_safe(list) {
|
||||
True -> True
|
||||
False ->
|
||||
range(0, length(list) - 1)
|
||||
|> any(fn(index) {
|
||||
let assert #(before, [_, ..after]) = list |> split(index)
|
||||
flatten([before, after]) |> is_safe
|
||||
})
|
||||
}
|
||||
|
||||
type Direction {
|
||||
Increasing
|
||||
Decreasing
|
||||
}
|
||||
|
||||
fn is_safe(list: List(Int)) -> Bool {
|
||||
|
|
Loading…
Reference in a new issue