• Skip to primary navigation
  • Skip to content
  • Skip to footer
fullfish fullfish 일상을 더 가볍게 만드는 앱을 만듭니다
  • Apps
  • Blog

    fullfish

    just studying

    • 전주

    같은 숫자는 싫어

    코드

    function solution(arr) {
      let result = [];
      for (let i = 0; i < arr.length; i++) {
        if (arr[i] !== arr[i - 1]) result.push(arr[i]);
      }
      return result;
    }
    

    filter를 이용한 코드 (메모리면에서도 이익)

    function solution(arr) {
      return arr.filter((ele, index) => ele != arr[index + 1]);
    }
    

    카테고리: 코딩 테스트, 프로그래머스 level1

    업데이트: September 7, 2022

    공유하기

    Twitter Facebook LinkedIn
    이전 다음

    참고

    fullweight 개인정보 처리방침 [ Project / fullweight ]

    https://github.com/full-fish/fullweight/blob/main/PRIVACY_POLICY.md

    멀티캠퍼스 KDT 데이터 분석가 최종 프로젝트 6차 수행일지 [ Project / multicampus-project ]

    [6차 프로젝트 수행일지_Tensor.docx

    멀티캠퍼스 KDT 데이터 분석가 최종 프로젝트 5차 수행일지 [ Project / multicampus-project ]

    [5차 프로젝트 수행일지_Tensor.docx

    멀티캠퍼스 KDT 데이터 분석가 최종 프로젝트 4차 수행일지 [ Project / multicampus-project ]

    [4차 프로젝트 수행일지_Tensor.docx

    • 팔로우:
    • 피드
    © 2026 fullfish. Powered by Jekyll & Minimal Mistakes.