- 알고리즘 문제 풀이 https://guco.tistory.com/333 https://guco.tistory.com/334 https://guco.tistory.com/335 알고리즘 문제만 풀었다 오늘.. [코테] Majority Element 문제링크 Majority Element - LeetCode Can you solve this real interview question? Majority Element - Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume guco.tistory...
문제링크 Best Time to Buy and Sell Stock II - LeetCode Can you solve this real interview question? Best Time to Buy and Sell Stock II - You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only hold leetcode.com Best Time to Buy and Sell Stock I에서 푼 풀이에서 조금만 바꾸면 될 것 같다 일단 profit 변수는 이익이 나..
문제링크 Best Time to Buy and Sell Stock - LeetCode Can you solve this real interview question? Best Time to Buy and Sell Stock - You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosin leetcode.com 일단 buy, sell, profit 이라는 변수를 생성하고, buy는 prices 배열의 첫 번째 값, sell과 profit은 0으로 초기화..
문제링크 Majority Element - LeetCode Can you solve this real interview question? Majority Element - Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists leetcode.com 배열의 요소를 하나씩 순회하며 .count() 메서드로 비교하는 로직을 처음에 생각했다 변수 answer를 0으로 초기화 해서 배열의 각 요소 값의 개수와 배열의 answer 값의..
- 알고리즘 문제 풀이 https://guco.tistory.com/329 https://guco.tistory.com/330 https://guco.tistory.com/331 생각보다 많이 푼 듯?! 내일은 더 열심히 풀어야겠네,,,5문제 남음 근데 이것도 이렇게 걸리면 더 어려운 문제들은 기한 안에 다 못 풀겠는걸...? [코테] Remove Element 문제링크 Remove Element - LeetCode Can you solve this real interview question? Remove Element - Given an integer array nums and an integer val, remove all occurrences of val in nums in-place [https:..