본문 바로가기

leetcode48

21] Leetcode 657. Robot Return to Origin Robot Return to Origin - 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 judgeCircle(string moves) { int upDown = 0; int leftRight =0; for(int i = 0;i 2020. 7. 1.
20] Leetcode 1450. Number of Students Doing Homework at a Given Time Number of Students Doing Homework at a Given Time - 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 busyStudent(vector& startTime, vector& endTime, int queryTime) { int ans =0; for(int i = 0;i 2020. 7. 1.
18] Leetcode 1475. Final Prices With a Special Discount in a Shop Final Prices With a Special Discount in a Shop - 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문 돌면서 다음 숫자부터 마지막까지 숫자들 중에 for문의 숫자보다 더 작은 게 있는지 확인하는 문제. class Solution { public: vector finalPrices(vector& prices) { vector ans; bool flag = false; for(int i = 0;i 2020. 6. 29.
17] Leetcode 1323. Maximum 69 Number 6과 9로 이뤄진 숫자가 주어졌을 때 단 하나의 6을 9로 바꿨을 때의 최댓값을 리턴하는 문제 Maximum 69 Number - 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 주어진 숫자에서 6이 있는 가장 큰 자릿수를 구해서 그 자릿수에 3을 더 해준다 pow함수 사용 class Solution { public: int maximum69Number (int num) { int max6= -1; // 6이 있는 최대 자릿수 int ans = num; for(i.. 2020. 6. 29.