Skip to content

Conversation

@JRedden27
Copy link

No description provided.

@kburd kburd self-requested a review December 3, 2020 19:16
Copy link

@kburd kburd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 97%

@@ -1,21 +1,94 @@
class ArrayUtils{

isEmpty(array){return false;}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works in JS but won't work in other languages, just a heads up

if(arr1.length > arr2.length) {
for(let i = 0; i < arr1.length; i++) {
if(arr1[i] !== arr2[i]) {
mismatch ++;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is found, you could return false instead of breaking, achieves the same goal

break;
}
}
if(match != null) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could start match at -1 and return the final value of match instead of checking if match is null

reverse(original){
let opposite = [];
for(let i = 0; i < original.length; i++) {
opposite.unshift(original[i]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice usage of built in functions 👍


equals(arr1, arr2){return false;}
equals(arr1, arr2){
let mismatch = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the arrays have different lengths than they can't be equal (-3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants