Skip to content
Discussion options

You must be logged in to vote

@LPenny-github

由於我問題太多,也希望讓大大們比較好回答,所以同一題 LeetCode 開了兩個 問題 😅

我覺得「拆開來問,讓每個討論串能聚焦在一個核心問題上」,是很好的選擇 👍 😊


綜合 LeetCode 的 3 個例題及你的 minTarget, maxTarget, 我會再加一個「兩個 index 都不是邊界值」的測試案例。

也就是說,

  • 目前 5 個測試的預期答案的 index1 都是 1, 也就是 inputNumbers 最小的 index
  • index2 在 LeetCode 範例1的預期答案是 2, 不是 inputNumbers 最大的 index
  • index2 在 LeetCode 範例1以外的預期答案 都是 inputNumbers 最大的 index

是故,可以加一測試案例:

  • inputNumbers: {-1000, -505, 5, 510, 1000}
  • target: 5
  • expected: {2, 4}

可以參考看看 😊

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LPenny-github
Comment options

Answer selected by LPenny-github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants