IT/알고리즘90 38] Leetcode 961. N-Repeated Element in Size 2N Array N-Repeated Element in Size 2N Array - 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 repeatedNTimes(vector& A) { int array[10001] = {0}; int ans = 0; for(int i = 0;i 2020. 8. 5. 37] Leetcode 1380. Lucky Numbers in a Matrix https://leetcode.com/problems/lucky-numbers-in-a-matrix/ Lucky Numbers in a Matrix - 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 행에서 최소인 값 구하고 동시에 그 값의 열의 위치를 구한 후에 그 열에서 최대값이면 lucky class Solution { public: vector luckyNumbers (vector& matrix) { vectorans; int num = 10000000; .. 2020. 7. 21. 36] Leetcode 1460. Make Two Arrays Equal by Reversing Sub-arrays https://leetcode.com/problems/make-two-arrays-equal-by-reversing-sub-arrays/ Make Two Arrays Equal by Reversing Sub-arrays - 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 두 배열을 구성하는 숫자가 다르면 무조건 false 숫자 개수가 다르거나, 없는 숫자가 있거나.. class Solution { public: bool canBeEqual(vector& targe.. 2020. 7. 21. 35★] Leetcode 1299. Replace Elements with Greatest Element on Right Side Replace Elements with Greatest Element on Right Side - 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문 두 번 돌려도 되지만 시간 초과. 대신 뒤에서부터 최댓값을 계산하면서 vector에는 앞에서부터 값을 추가해주면 된다. class Solution { public: vector replaceElements(vector& arr) { vectorans; int max = 0; ans.insert(ans.begin.. 2020. 7. 19. 이전 1 ··· 11 12 13 14 15 16 17 ··· 23 다음