{"size": 415, "ext": "js", "max_stars_repo_path": "M06/dicas/cyclic.js", "max_stars_repo_name": "ChristopherHauschild/fullstack-master", "max_stars_repo_stars_event_min_datetime": "2021-07-31T18:04:01.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-31T18:04:01.000Z", "max_issues_repo_path": "M06/dicas/cyclic.js", "max_issues_repo_name": "ChristopherHauschild/fullstack-master", "max_issues_repo_issues_event_min_datetime": "2021-03-11T01:15:58.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T08:03:34.000Z", "max_forks_repo_path": "M06/dicas/cyclic.js", "max_forks_repo_name": "ChristopherHauschild/fullstack-master", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 23.0555555556, "max_line_length": 42, "alphanum_fraction": 0.534939759}
// -> --inspect-brk

function solution(A, K) {
  const total = A.length;
  const result = [];
  for (let i = 0; i < total; i++) {
    // debug -> result = [1: 3, 2: 8, ...]
    // similar aos testes de mesa
    // testagem do for passo a passo
    const index = (i + K) % total;
    result[index] = A[i];
  }
  return result;
}

console.log(solution([3, 8, 9, 7, 6], 1));
console.log(solution([3, 8, 9, 7, 6], 2));
