Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 |
Tags
- java
- DP
- 컴퓨터과학과
- 방송대
- 완전탐색
- sliding window
- 리트코드
- 코딩
- 자바
- Git
- greedy
- 그리디
- LeetCode
- it
- 코테
- javascript
- 방통대
- algorithm
- 깃
- boj
- 알고리즘
- two pointers
- 탐욕알고리즘
- 투포인터
- 방송통신대학교
- 자바스크립트
- 이진탐색
- 백준
- dynamic programming
- Binary Search
Archives
- Today
- Total
개발이 취미인 주니어 기획자
[Sorting][JavaScript][LeetCode] #1491. Average Salary Excluding the Minimum and Maximum Salary 본문
문제 풀이/기본 구현
[Sorting][JavaScript][LeetCode] #1491. Average Salary Excluding the Minimum and Maximum Salary
큐 2023. 5. 2. 11:00728x90
반응형
#Sorting #EASY
Average Salary Excluding the Minimum and Maximum Salary - LeetCode
Can you solve this real interview question? Average Salary Excluding the Minimum and Maximum Salary - You are given an array of unique integers salary where salary[i] is the salary of the ith employee. Return the average salary of employees excluding the m
leetcode.com
🌷 문제 설명
✏️ LeetCode 연습문제: Average Salary Excluding the Minimum and Maximum Salary
You are given an array of unique integers salary where salary[i] is the salary of the ith employee.
Return the average salary of employees excluding the minimum and maximum salary. Answers within 10^-5 of the actual answer will be accepted.
🎃 제한 사항
3 <= salary.length <= 100
1000 <= salary[i] <= 10^6
All the integers of salary are unique
입출력 예
| nums | result |
| [4000, 3000, 1000, 2000] | 2500.00000 |
| [1000, 2000, 3000] | 2000.0000 |
🌷 내 코드

var average = function(salary) {
salary.sort((a,b) => a-b)
salary.pop()
salary.shift()
return salary.reduce((acc, curr) => acc + curr, 0) / salary.length
};
🌷 코멘트
사실 이런건 너무 별거 아니라서 블로그에는 안 올리려고 하는데 (블로그엔 안올려도 깃허브엔 1일 1커밋 하고 있읍니당)
99%는 귀하니까.. 기록..
블로그 내용에 문제가 있다면 댓글 혹은 아래로 연락주세요!
~대가리 꽃밭인 디지털 노마드가 꿈이예요~
🧚♀️ Gyumin Lee
📧 gyumin.q.lee@gmail.com
qminlee723 - Overview
noob. qminlee723 has 8 repositories available. Follow their code on GitHub.
github.com
728x90
반응형
'문제 풀이 > 기본 구현' 카테고리의 다른 글
| [해시맵][JavaScript][LeetCode] #13. Roman to Integer (0) | 2023.04.20 |
|---|---|
| [해쉬맵][JavaScript][LeetCode] #1. Two Sum (1) | 2023.04.11 |
| [Javascript][프로그래머스] 숫자 짝꿍 자바스크립트 (0) | 2023.03.05 |
| [Javascript][프로그래머스] 카드뭉치 자바스크립트 (0) | 2023.02.17 |