python 20

[leetcode 198. python] 집 도둑 (House Robber) 풀이

https://leetcode.com/problems/house-robber/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 당신은 프로페셔널한 도둑이다. 길을 따라 있는 집의 돈을 훔치려한다. 딱 한 가지 제약은, 하루동안 바로 옆에 인접(adjacent)해 있는 집의 돈을 훔칠 시, 경찰과 연결된 보안경보가 자동으로 울린다는 사..

Algorithm/LeetCode 2024.01.23

[boj 1244.python] '스위치 켜고 끄기' 풀이

https://www.acmicpc.net/problem/1244 1244번: 스위치 켜고 끄기 첫째 줄에는 스위치 개수가 주어진다. 스위치 개수는 100 이하인 양의 정수이다. 둘째 줄에는 각 스위치의 상태가 주어진다. 켜져 있으면 1, 꺼져있으면 0이라고 표시하고 사이에 빈칸이 하나씩 www.acmicpc.net 문제 이러한 규칙에 따라 학생들이 스위치를 조작하고 난 후의 스위치 상태를 구해야 한다. (자세한 입/출력 설명과 예제는 포스팅 상단의 문제를 참고해주길 바란다) 문제 이해 알고리즘 문제 푼 지 2주차가 되어 가니 슬슬 어느 지점에서 어떻게 생각해야 편할지 길이 보이는 것 같기도 하다. 남자와 여자의 행동 양식이 달라서, 남자 여자를 따로 생각하고, 와중에 남자/ 여자가 똑같이 해야하는 부분..

Algorithm/BaekJoon 2024.01.15

[leetcode 206.python] 역순 연결 리스트 (Reverse Linked List) 풀이

https://leetcode.com/problems/reverse-linked-list/ Reverse Linked List - LeetCode Can you solve this real interview question? Reverse Linked List - Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: [https://assets.leetcode.com/uploads/2021/02/19/rev1ex1.jpg] Input: head = [1,2,3,4,5] O leetcode.com 본 포스팅은 책에서 다룬 리트코드 문제들을 다루고 있으며, 문제 풀이의 많은 부분을 책의..

Algorithm/LeetCode 2024.01.08

[leetcode 561.python] 배열 파티션 1(Array-partition 1) 풀이

https://leetcode.com/problems/array-partition/ Array Partition - LeetCode Can you solve this real interview question? Array Partition - Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum. leetcode.com 문제 Given an integer array nums of 2n integers, group t..

Algorithm/LeetCode 2024.01.03