因為所有問題都已經在截圖里,所以就不另外說了。這個題目我想了一天都沒想出來,后來有個群的朋友告訴我這個方法。這個代碼也是他寫好的,我大致弄懂了思路,但還是想不明白為什么return的數組,不是ints[i]在前面。我試過了,如果把return的數組兩個元素對調,就無法通過檢測。圖片不夠清晰,還是把詳情寫一下吧。題目大意:Sum of PairsGiven a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum.示例:我提交的代碼:
Sum of Pairs,一代碼里看不懂的問題。
倚天杖
2018-10-11 14:11:26