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 |
Tags
- 기초
- leetcode189
- Rest
- JS
- 파이어베이스로그인
- mac
- React
- react-firebaseui
- youtube iframe
- iP
- 다리놓기
- Spread
- Python
- nvmrc
- css
- react-native
- 백준
- 프로토타입
- 타입스크립트
- 파이썬
- leetcode977
- firebaseui
- 리액트
- 구조분해할당
- yarn-berry
- Next.js
- nvm
- 자바스크립트
- 커스텀알락
- 커스텀알림
Archives
- Today
- Total
목록leetcode977 (1)
JadeCode
[Leetcode] Algorithm Day2 Two Pointers
977. Squares of a Sorted Array 정렬하기. 하지만 sort내장함수 쓰지 않고 시간복잡도 O(n)으로 만들기 1. 일단 각 숫자들을 문제에 나와있는대로 제곱을 한다. 2. 선택 정렬 알고리즘 사용한다. * 선택정렬 알고리즘 배열을 돌면서 최소값을 찾아간다. 현재 index와 최소값을 가진 index를 swap한다. /** * @param {number[]} nums * @return {number[]} */ var sortedSquares = function (nums) { nums = nums.map((el) => Math.abs(el) * Math.abs(el)); const swap = (a, b, nums) => { [nums[a], nums[b]] = [nums[b], nu..
카테고리 없음
2023. 3. 18. 20:00