Skip to content

Commit

Permalink
Revert "square-root"
Browse files Browse the repository at this point in the history
This reverts commit dab0c41.
  • Loading branch information
0xNeshi committed Sep 13, 2024
1 parent dab0c41 commit 7e68ba6
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions exercises/practice/sublist/.meta/example.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@ pub fn sublist<T, +PartialEq<T>>(a: @Array<T>, b: @Array<T>) -> Comparison {
fn contains<T, +PartialEq<T>>(a: Span<T>, b: Span<T>) -> 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;
}
}

0 comments on commit 7e68ba6

Please sign in to comment.