본문 바로가기

릿코드12

42] Leetcode 1528. Shuffle String https://leetcode.com/problems/shuffle-string/ Shuffle String - 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 ans와 s는 길이가 같을 테니 초기값을 s로 하고 하나씩 바꾼다. class Solution { public: string restoreString(string s, vector& indices) { string ans = s; for(int i = 0;i 2020. 8. 18.
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.