목록분류 전체보기 (147)
게으른개발너D
https://leetcode.com/problems/function-composition/ Function Composition - LeetCode Can you solve this real interview question? Function Composition - Given an array of functions [f1, f2, f3, ..., fn], return a new function fn that is the function composition of the array of functions. The function composition of [f(x), g(x), h( leetcode.com Given an array of functions [f1, f2, f3, ..., fn], ret..
https://leetcode.com/problems/array-reduce-transformation/ Array Reduce Transformation - LeetCode Can you solve this real interview question? Array Reduce Transformation - Given an integer array nums, a reducer function fn, and an initial value init, return a reduced array. A reduced array is created by applying the following operation: val = f leetcode.com Given an integer array nums, a reducer..
https://leetcode.com/problems/sleep/ Sleep - LeetCode Can you solve this real interview question? Sleep - Given a positive integer millis, write an asynchronous function that sleeps for millis milliseconds. It can resolve any value. Example 1: Input: millis = 100 Output: 100 Explanation: It should retur leetcode.com Given a positive integer millis, write an asynchronous function that sleeps for ..
https://leetcode.com/problems/counter/ Counter - LeetCode Can you solve this real interview question? Counter - Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent time it is called (n, n + 1, n + 2, etc). leetcode.com Given an integer n, return a counter function. This counter function initiall..
https://leetcode.com/problems/array-prototype-last/ Array Prototype Last - LeetCode Can you solve this real interview question? Array Prototype Last - Write code that enhances all arrays such that you can call the array.last() method on any array and it will return the last element. If there are no elements in the array, it should retur leetcode.com Write code that enhances all arrays such that ..
https://school.programmers.co.kr/learn/courses/30/lessons/181854 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정수 배열 arr과 정수 n이 매개변수로 주어집니다. arr의 길이가 홀수라면 arr의 모든 짝수 인덱스 위치에 n을 더한 배열을, arr의 길이가 짝수라면 arr의 모든 홀수 인덱스 위치에 n을 더한 배열을 return 하는 solution 함수를 작성해 주세요. function solution(arr, n) { let answer = []; const arrL = arr.length; if(..
https://school.programmers.co.kr/learn/courses/30/lessons/181908 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr suff가 str의 마지막 문자에 해당되는가? 풀이 ) function solution(my_string, is_suffix) { return my_string.slice(my_string.length - is_suffix.length) === is_suffix ? 1 : 0; } endsWith를 이용한 풀이 ) function solution (my_string, is_suffix) { re..

Player 기능을 개발하는 도중 Player Component 안에서 사용하는 state들이 불필요하게 반복 호출된다는 점을 알게되었다. 아래는 페이지를 새로고침했을 때의 영상이다. console log로 몇번 호출하는지 count를 새보니 3번이나 반복 호출된다. 처음에는 Player component 안에서 사용하는 useEffect때문인줄 알았다. useEffect 안에서 state값을 변경하면 컴포넌트 위에서부터 state 값을 다시 호출하기 때문이다. function CocoPlayer() { const playList = useRecoilValue(playListState); const [nowPlayingIdx, setNowPlayingIdx] = useState(savedNowPlayi..