coding 13

[컴퓨터 알고리즘] in place / not in place 정렬 알고리즘

In place vs not In place Algorithm in place 정렬은 원소들의 개수에 비해 충분히 무시할 만한 저장 공간만을 더 사용하는 정렬 알고리즘 not in place 정렬은 원소들의 개수에 비례하여 저장 공간을 더 사용하는 정렬 알고리즘 sentinel value란? -. 더 이상의 처리 또는 사용 할 데이터가 없는 걸 나타내기 위한 값 e.g. merge sort에서 2개의 list 내의 끝에 위치한 값을 ∞로 설정하기도 한다. https://velog.io/@cookncoding/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EA%B0%9C%EB%85%90-Stable-Sort-Inplace [알고리즘 개념] Stable Sort &Inplace 컴퓨터 ..

[C#] 백준 알고리즘 - 설탕 배달

문제 : 백준 알고리즘 2839번 문제 https://www.acmicpc.net/problem/2839 2839번: 설탕 배달 상근이는 요즘 설탕공장에서 설탕을 배달하고 있다. 상근이는 지금 사탕가게에 설탕을 정확하게 N킬로그램을 배달해야 한다. 설탕공장에서 만드는 설탕은 봉지에 담겨져 있다. 봉지는 3킬로그 www.acmicpc.net 풀이 : // Input int input = int.Parse(ReadLien()); // 설탕 int count = -1; // 봉지 개수 // Processing while (input > 0) { if (input % 5 == 0) { input -= 5; Count++; } else if (input % 3 == 0) { input -= 3; Count++; ..

[C#] 프로그래머스 알고리즘 - 숫자 정렬

문제 : 프로그래머스 https://programmers.co.kr/skill_checks/369129?challenge_id=947 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 : using System; using System.Collections.Generic; using System.Linq; public class Solution { public long solution(long n) { long answer = 0; char[] a = n.ToString().ToCharArray(); Array.Sort(a); Array.Reverse(..

[Python] - Coding Test / 6097 문제

✍ CodeUp 문제 / 출처 : Codeup 👉 Input → 👉 Output → 👉 Source Code h, w = map(int, input().split()) n = int(input()) grid = [list(0 for _ in range(w)) for _ in range(h)] for i in range(n): l , d, x, y = map(int, input().split()) x -= 1 y -= 1 # 가로 if d == 0: for j in range(l): grid[x][y + j] = 1 else: for j in range(l): grid[x + j][y] = 1 for i in range(h): print(*grid[i]) # * 연산자 사용하여 list 형태 없애고 1개씩..