반응형

Good morning! Here's your coding interview problem for today.

This problem was asked by Uber.

Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i.

For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 1], the expected output would be [2, 3, 6].

Follow-up: what if you can't use division?

 


(Google번역)

좋은 아침! 오늘의 코딩 인터뷰 문제는 다음과 같습니다.
이 문제는 Uber에서 요청했습니다.
정수 배열이 주어지면 새 배열의 인덱스 i에 있는 각 요소가 i에 있는 것을 제외한 원래 배열의 모든 숫자의 곱이 되도록 새 배열을 반환합니다.
예를 들어 입력이 [1, 2, 3, 4, 5]인 경우 예상 출력은 [120, 60, 40, 30, 24]입니다. 입력이 [3, 2, 1]인 경우 예상 출력은 [2, 3, 6]입니다.
후속 조치: 나눗셈을 사용할 수 없으면 어떻게 합니까?

 


 

매일 문제을 받고 싶다면 아래 링크에서 구독해보세요.

(단, 문제 풀이는 프리미엄 구독자만 받을 수 있음)

https://www.dailycodingproblem.com/

 

Daily Coding Problem

There's a staircase with N steps, and you can climb 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 unique ways:

www.dailycodingproblem.com

 

+ Recent posts