Notice
Recent Posts
Recent Comments
- Today
- Total
01-11 11:00
Tags
- ์๋ฐ์์ ์
- array
- database
- PS
- spring
- ๋ค์ต์คํธ๋ผ
- dp
- pytorch
- ์ธํด
- ๊ตฌํ
- ๋ฐฑ์ค
- ๋ฒจ๋งํฌ๋
- ์๋ฐ
- ํ๋ก๊ทธ๋๋จธ์ค
- ์์์ ๋ ฌ
- ๋ฐฑ์๋
- tree
- ๊ทธ๋ฆฌ๋
- ์๋ฃ๊ตฌ์กฐ
- Graph
- BFS
- CS
- OOP
- Algorithm
- leetcode
- ๋ฌธ๋ฒ
- MST
- ์กธ์ ์ํ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- java
Link
Partially Committed
[์ํด๋ฆฌ ์ฑ๋ฆฐ์ง] ์ต์์ง์ฌ๊ฐํ ๋ณธ๋ฌธ
๐ฅ Algorithm || ๋ฌธ์ ํ์ด/PS
[์ํด๋ฆฌ ์ฑ๋ฆฐ์ง] ์ต์์ง์ฌ๊ฐํ
WonderJay 2022. 7. 4. 21:48728x90
๋ฐ์ํ
SMALL
https://programmers.co.kr/learn/courses/30/lessons/86491
๋ชจ๋ ๋ช ํจ๋ค์ ๊ธด ํธ์ด ๊ฐ๋ก๊ฐ ๋๊ฒ ๋ํ ๋ค์, ๋ช ํจ๋ค์ ์ธ๋ก ๊ธธ์ด ์ค ์ต๋๋ฅผ ์ ํํ๋ฉด
๋ชจ๋ ๋ช ํจ์ ๋ฃ์ ์ ์์ผ๋ฉด์๋ ๋์ด๋ ๊ฐ์ฅ ์ต์์ธ ๋ช ํจ ์ง๊ฐ์ด ๋๋ค.
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
void rotate_namecard(vector<int>& namecard)
{
swap(namecard[0], namecard[1]);
}
int get_area(int a, int b)
{
return a*b;
}
int solution(vector<vector<int>> sizes) {
int answer = 0;
int m_row = 0, m_col = 0;
vector<int> width;
vector<int> height;
for (auto& ele : sizes)
{
if (ele[0] > ele[1])
rotate_namecard(ele);
}
for (auto& ele : sizes)
{
if (ele[0] > m_col)
m_col = ele[0];
if (ele[1] > m_row)
m_row = ele[1];
}
answer = get_area(m_col, m_row);
return answer;
}
[C++]
728x90
๋ฐ์ํ
LIST
'๐ฅ Algorithm || ๋ฌธ์ ํ์ด > PS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์ํด๋ฆฌ ์ฑ๋ฆฐ์ง] ๋ถ์กฑํ ๊ธ์ก ๊ณ์ฐํ๊ธฐ (0) | 2022.07.05 |
---|---|
[์๊ฐ ์ฝ๋ ์ฑ๋ฆฐ์ง ์์ฆ3] ๋๋จธ์ง๊ฐ 1์ด ๋๋ ์ ์ฐพ๊ธฐ (0) | 2022.07.05 |
[ํ๋ก๊ทธ๋๋จธ์ค] 2016๋ (0) | 2022.07.04 |
[์๊ฐ ์ฝ๋ ์ฑ๋ฆฐ์ง ์์ฆ1] ๋ ๊ฐ ๋ฝ์์ ๋ํ๊ธฐ (0) | 2022.07.04 |
[Summer/Winter Coding(~2018)] ์์ฐ (0) | 2022.07.04 |
Comments