Skip to content
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

67题 #114

Closed
zo11o opened this issue May 6, 2019 · 1 comment
Closed

67题 #114

zo11o opened this issue May 6, 2019 · 1 comment

Comments

@zo11o
Copy link

zo11o commented May 6, 2019

function formatArray (arr) {
  let result = []

  arr.sort((a, b) => {
    return a - b
  })

  arr = _unique(arr)
  let i = 4
  let n = 0
  while (n < 7) {
    result.push(arr.slice(n, i + n))
    n = n + i
    i = (i / 2)
  }

  function _unique (arr) {
    var x = new Set(arr)
    return [...x]
  }

  return result
}

formatArray([2, 10, 3, 4, 5, 11, 10, 11, 20])
@yygmind
Copy link
Contributor

yygmind commented May 6, 2019

已有 ISSUE #113

@yygmind yygmind closed this as completed May 6, 2019
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

No branches or pull requests

2 participants