'Algorithm' 카테고리의 글 목록
-
1464. Maximum Product of Two Elements in an Array [배열, 정렬, Heap (Priority Queue)]
설명 정수들의 배열이 주어지면, 당신은 배열의 서로 다른 두 지수 i와 j를 선택할 것이다. (nums[i]-1)*(nums[j]-1)의 최대값을 반환하라. https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/입력, 출력Example 1:Input: nums = [3,4,5,2]Output: 12 Explanation: If you choose the indices i=1 and j=2 (indexed from 0), you will get the maximum value, that is, (nums[1]-1)*(nums[2]-1) = (4-1)*(5-1) = 3*4 = 12. Example 2:Input: nums = [..
Algorithm/LeetCode
2024. 8. 16.
-
백준 파이썬 10814 숫자 카드 2
https://www.acmicpc.net/problem/10816 10816번: 숫자 카드 2 첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10,0 www.acmicpc.net Code import sys input = sys.stdin.readline n = int(input()) # 10 cards = list(map(int, input().split())) # [6, 3, 2, 10, 10, 10, -10, -10, 7, 3] m = int(input()) # 8 my_cards = list(map(int, input().spli..
Algorithm/backjoon
2023. 10. 16.
💲 추천 글