Skip to content

Commit

Permalink
update solutuion of P21
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Mar 20, 2024
1 parent 8a730dc commit 4cf28c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Src/Problem21.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ variable {α : Type}

def insertAt (e : α) (l : List α) (i : Nat) : List α :=
-- sorry
l.take (i - 1) ++ [e] ++ l.drop (i - 1)
match l, i with
| a :: b , i + 2 => a :: insertAt e b (i + 1)
| _ , _ => e :: l
-- sorry

-- The following code is a test case and you should not change it.
Expand Down

0 comments on commit 4cf28c7

Please sign in to comment.