leetcode48 25★] Leetcode 1496. Path Crossing https://leetcode.com/problems/path-crossing/ 방향을 가리키는 문자열을 따라 이동했을 때 같은 점은 두 번 지나가는지 묻는 문제. Path Crossing - 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 for문으로 원점을 처음부터 하나씩 바꿔가면서 다시 원점으로 돌아가는지 확인한다. class Solution { public: bool isPathCrossing(string path) { bool ans = false; in.. 2020. 7. 5. 24] Leetcode 1502. Can Make Arithmetic Progression From Sequence Can Make Arithmetic Progression From Sequence - 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: bool canMakeArithmeticProgression(vector& arr) { sort(arr.begin(),arr.end()); bool flag = true; int diff = arr[1]-arr[0]; for(int i = 2;i 2020. 7. 5. 23] Leetcode 728. Self Dividing Numbers https://leetcode.com/problems/self-dividing-numbers/ Self Dividing Numbers - 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 범위 내 숫자들 중에 각 자릿수로 나눠 떨어지는 숫자의 개수를 반환하는 문제. 안 되는 숫자는 0을 포함하고 있거나, 나눠 떨어지지 않는 경우이다. 그 경우만 제외하고 vector에 넣어주면 된다. class Solution { public: vector selfDividingNu.. 2020. 7. 4. 22] Leetcode 1446. Consecutive Characters Consecutive Characters - 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 maxPower(string s) { int ans = 1; int startPoint = 0; char startChar= s[0]; for(int i = 1;i 2020. 7. 3. 이전 1 ··· 4 5 6 7 8 9 10 ··· 12 다음