| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- 코드로배우는스프링부트웹프로젝트
- 처음 만나는 AI 수학 with Python
- d
- 자료구조와함께배우는알고리즘입문
- 자료구조와 함께 배우는 알고리즘 입문
- 리눅스
- 네트워크 설정
- resttemplate
- 데비안
- 알파회계
- iterator
- Kernighan의 C언어 프로그래밍
- /etc/network/interfaces
- 친절한SQL튜닝
- 목록처리
- network configuration
- 자바편
- 티스토리 쿠키 삭제
- GIT
- 구멍가게코딩단
- 처음 만나는 AI수학 with Python
- ㅒ
- 서버설정
- 코드로배우는스프링웹프로젝트
- 선형대수
- 페이징
- 스프링부트핵심가이드
- 이터레이터
- 스프링 시큐리티
- baeldung
- Today
- Total
목록Algorithm Practice/LeetCode (12)
bright jazz music
Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.Note that you must do this in-place without making a copy of the array. Example 1:Input: nums = [0,1,0,3,12]Output: [1,3,12,0,0]Example 2:Input: nums = [0]Output: [0] Constraints:1 /** Do not return anything, modify nums in-place instead. */ // 접근 방법//Two Pointer 방식을 사용// left..
Given an array of characters chars, compress it using the following algorithm:Begin with an empty string s. For each group of consecutive repeating characters in chars:If the group's length is 1, append the character to s.Otherwise, append the character followed by the group's length.The compressed string s should not be returned separately, but instead, be stored in the input character array ch..
function increasingTriplet(nums: number[]): boolean { // first: 지금까지 본 가장 작은 값 // second: first보다 크면서 가장 작은 값 let first = Infinity; let second = Infinity; for(let num of nums) { if(num second > first // triplet 완성! return true; } } return false;}// 잘못된 접근// function increasingTriplet(nums: number[]): boolean {// // 각 인덱스를 ..
// 나의 접근 방법. O(n2)function productExceptSelf(nums: number[]): number[] { let answerArr: number[] = [] for(let i = 0; i = 0; j--) { // ← >= 0으로 수정 answer *= nums[j] } answerArr.push(answer); } else { // ← 중간 요소들 처리 추가 필요 let answer = 1; // 왼쪽 곱 for(let j = 0; j Given an integer array nums, return an array answer ..
https://leetcode.com/problems/reverse-words-in-a-string/?envType=study-plan-v2&envId=leetcode-75function reverseWords(s: string): string { // 먼저 트림하고 let trimedWords = s.trim(); // ' ' 를 기준으로 split한 뒤에 // pop 해서 스트링에 붙여서 반환 // let splitWordsArr = trimedWords.split(' '); // 위처럼만 하면 ' ' 이런 경우 공백이 붙어버리기 때문에 // filter(w => w !== '') 이걸 써서 공백을 없애버려야 한다. let splitWordsArr = ..
function reverseVowels(s:string): string { // const vowels = ['a','e','i','o','u','A','E','I','O','U']; const vowels = new Set(['a','e','i','o','u','A','E','I','O','U']); let arr = s.split(''); let left = 0; let right = arr.length -1; while( left 투 포인터로 푸는 게 나은 문제였다. 나는 원래 아래와 같이 풀려고 했다. function reverseVowels(s: string): string { const vowels = ['a','e','i','o','u','A','E..
605. Can Place FlowersSolvedEasyTopicsconpanies iconCompaniesYou have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flowerbed without violating the..
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one solution, and you may not use the same element twice.You can return the answer in any order. Example 1:Input: nums = [2,7,11,15], target = 9Output: [0,1]Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].Example ..
SQL SchemaTable: Customers+-------------+---------+| Column Name | Type |+-------------+---------+| id | int || name | varchar |+-------------+---------+id is the primary key column for this table.Each row of this table indicates the ID and name of a customer. Table: Orders+-------------+------+| Column Name | Type |+-------------+------+| id | int || customerId ..
SQL SchemaTable: Customer+-------------+---------+| Column Name | Type |+-------------+---------+| id | int || name | varchar || referee_id | int |+-------------+---------+id is the primary key column for this table.Each row of this table indicates the id of a customer, their name, and the id of the customer who referred them. Write an SQL query to report the names of..