일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 알고리즘
- node.js
- 최강의 인생
- 자바스크립트
- 개발자의 책장
- Where
- select
- 배열
- SQL
- join
- 코플릿
- 블록체인
- for문
- 개발자_조이킴
- 코딩공부
- 코드스테이츠
- array
- Algorithms
- JavaScript
- 정규표현식
- 재귀함수
- Hackerrank
- MySQL
- Developer_JoyKim
- Programmers
- 프로그래머스
- 역행자
- array.slice()
- 코딩테스트
- array.push()
- Today
- Total
목록array.length (3)
CodingSpace
Problem. Warmup - Plus Minus Link. https://www.hackerrank.com/challenges/plus-minus/problem?isFullScreen=true Diagonal Difference | HackerRank Calculate the absolute difference of sums across the two diagonals of a square matrix. www.hackerrank.com Description. Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each ..
Problem. getAllElementsButNth Description. 배열과 인덱스를 입력받아 해당 인덱스의 요소를 제외한 배열을 리턴하는 함수를 작성하시오. ※ 배열의 길이보다 큰 인덱스를 입력받은 경우, 입력받은 배열 그대로 반환 입력: 인자1: arr 임의의 요소를 갖는 배열 인자2: n number 타입의 인덱스 출력: 인덱스에 해당하는 요소를 제외한 배열을 반환 My Answer. function getAllElementsButNth(arr, n) { if(n > arr.length) return arr; arr.splice(n, 1); return arr; } Comments. 코드스테이츠 저작권으로 문제가 된다면 본 게시물 비공개로 처리하겠습니다! SEB IM 34기 수료생
Problem. getLongestWord Description. 문자열을 입력받아 문자열에서 가장 긴 단어를 리턴하는 함수를 작성하시오. ※ 입력받은 배열이 빈 배열인 경우 0을 반환한다. 입력: 인자1: str string 타입의 공백이 있는 알파벳 문자열 출력: string 타입을 반환 My Answer. function getLongestWord(str) { // 공백을 기준으로 단어를 쪼개 배열로 만든다. let arr = str.split(" "); let answer = arr[0]; for(let i = 1; i < arr.length; i++) { // 만약 현재 단어(answer)보다 길이가 긴 경우, answer 단어를 바꿔준다. (arr[i]) if(answer.length < ar..