알고리즘/leetcode26 Push Dominoes // mine // 40ms, 16.6MB class Solution { public: string pushDominoes(string dominoes) { int size = dominoes.size(); vector counter(size); char prev = dominoes[0]; int count = 0; for (int i = 1; i < size; ++i) { char cur = dominoes[i]; if (cur == '.' && prev == 'R') counter[i] = ++count; if (cur == 'L' || cur == 'R') { count = 0; prev = cur; } } prev = dominoes[size - 1]; count = 0; for (int i = .. 2021. 7. 22. leetcode - Find the Town Judge - easy https://leetcode.com/problems/find-the-town-judge/ Find the Town Judge - 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 findJudge(int n, vector& trust) { vector first_(n+1); vector second_(n+1); int size = trust.size(); for (int i = 0; i < size; ++i) {.. 2020. 9. 22. 이전 1 ··· 4 5 6 7 다음