From 7e68ba6a00fca4cf4afcb3b5a0c32d53e6fca271 Mon Sep 17 00:00:00 2001 From: Nenad Date: Fri, 13 Sep 2024 15:10:19 +0200 Subject: [PATCH] Revert "square-root" This reverts commit dab0c41d29a6e7978acbebc88bf98c92aa20a3bc. --- .../practice/sublist/.meta/example.cairo | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/exercises/practice/sublist/.meta/example.cairo b/exercises/practice/sublist/.meta/example.cairo index 9e5c5543..feefeb4c 100644 --- a/exercises/practice/sublist/.meta/example.cairo +++ b/exercises/practice/sublist/.meta/example.cairo @@ -23,19 +23,16 @@ pub fn sublist>(a: @Array, b: @Array) -> Comparison { fn contains>(a: Span, b: Span) -> bool { if a.len() < b.len() { return false; - } else if a.slice(0, b.len() - 1) == b { - return true; - } else { - return contains(a.slice(1, a.len() - 1), b); } - // let mut i = 0; -// loop { -// if i == a.len() - b.len() { -// break true; -// } -// if a[i] != b[i] { -// break contains(a.slice(1, a.len() - 1), b); -// } -// i += 1; -// } + + let mut i = 0; + loop { + if i == b.len() { + break true; + } + if a[i] != b[i] { + break contains(a.slice(1, a.len() - 1), b); + } + i += 1; + } }