본문 바로가기

leetcode48

12] Leetcode 1486. XOR Operation in an Array 배타적 논리합, XOR 연산에 관한 문제다. XOR Operation in an 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 초기값만 start로 해주고 나머지는 이어서 고대로 해주면 된다. class Solution { public: int xorOperation(int n, int start) { int ans = start; for(int i = 1;i 2020. 6. 24.
11] Leetcode 1295. Find Numbers with Even Number of Digits 숫자들 중에 짝수 자릿수인 숫자의 개수를 반환하는 문제. Find Numbers with Even Number of Digits - 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 findNumbers(vector& nums) { int ans = 0; int sth =0; for(int i = 0; i 2020. 6. 24.
10] Leetcode 1389. Create Target Array in the Given Order Create Target Array in the Given Order - 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: vector createTargetArray(vector& nums, vector& index) { vectorans; for(int i = 0;i 2020. 6. 23.
9] Leetcode 1281. Subtract the Product and Sum of Digits of an Integer Subtract the Product and Sum of Digits of an Integer - 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이 될때까지 한다. 곱하는 건 초기값이 1, 더하는 건 0으로 ~ class Solution { public: int subtractProductAndSum(int n) { int product = 1; int sum = 0; while(n.. 2020. 6. 22.