-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ports - Jillianne #45
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
# Determines if the two input arrays have the same count of elements | ||
# and the same integer values in the same exact order | ||
def array_equals(array1, array2) | ||
raise NotImplementedError | ||
|
||
def array_equals(array_a, array_b) | ||
if (array_a == [] && array_b == [] || array_a == nil && array_b == nil) | ||
return true | ||
elsif array_a == nil || array_b == nil || array_a.length != array_b.length | ||
return false | ||
else | ||
array_a.length.times do |item| | ||
if array_b[item] != array_a[item] | ||
return false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It returns false as soon as it finds two chars that don't match. Brilliant! Have a 🍬 |
||
end | ||
end | ||
return true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AND..... SHE STICKS THE LANDING! Returns true if all chars match. Perf. 🔥 |
||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow! I like how you used a compound conditional to group all the true and false edge cases together. VERY NICE. ✨✨✨