본문 바로가기

leetcode48

29★] Leetcode 1013. Partition Array Into Three Parts With Equal Sum https://leetcode.com/problems/partition-array-into-three-parts-with-equal-sum/ Partition Array Into Three Parts With Equal Sum - LeetCode 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 int 벡터를 공백이 아니고 합이 같은 세 개의 부분 배열로 나눌 수 있는지 묻는 문제. class Solution { public: bool canThreePartsEqualSum(vec.. 2020. 7. 7.
28] Leetcode 1021. Remove Outermost Parentheses https://leetcode.com/problems/remove-outermost-parentheses/ Remove Outermost Parentheses - LeetCode 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 바깥 괄호를 제거하는 문제다. (일때 시작하는 괄호인지 )일때 마지막 괄호인지를 확인하면 된다, class Solution { public: string removeOuterParentheses(string S) { string ans = ""; int c.. 2020. 7. 6.
27] Leetcode 1266. Minimum Time Visiting All Points https://leetcode.com/problems/minimum-time-visiting-all-points/ Minimum Time Visiting All Points - LeetCode 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 가로로 세로로, 대각선으로 한 칸씩 갈 수 있기 때문에 가로, 세로의 차 중에 큰 값으로 더 해주면 된다. class Solution { public: int minTimeToVisitAllPoints(vector& points) { int .. 2020. 7. 6.
26★] Leetcode 1491. Average Salary Excluding the Minimum and Maximum Salary Average Salary Excluding the Minimum and Maximum Salary - LeetCode 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 1. 문제를 똑바로 이해하고 2. 반환값이 int인지 double인지 확인하고 class Solution { public: double average(vector& salary) { sort(salary.begin(), salary.end()); double total = 0.0; for(int i = 1;i 2020. 7. 5.