Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const findRep = (array) => {
- const compare = (x, y) => {
- return x == y
- }
- const len = array.length
- let i, j
- let repeat = []
- for(i = 0; i < len / 2; i++){
- for(j = 0; j <= i; j++){
- if(!compare(array[len - 2 - i - j], array[len - 1 - j])){
- continue
- }
- }
- if(i == j - 1){
- repeat = array.slice(len - j, len)
- }
- }
- return repeat
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement