We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS 10.13.6 Xcode 10.1 Swift 4.2.1 / Swift 4.2 leetcode.com
md5: 5c598e7de23d1e53e35af4dbdd1cd08e
Issue Description:
Steps :
Create a subarray
Find the index of an item from the subarray
Problem :
It is returning the index from the original array.
var originalArray = [1, 2, 3, 4, 5, 6, 7] print("original array : \(originalArray)") let indexA = originalArray.index(of: 5)! print("index of #​5 : \(indexA)") let subArray = originalArray[3 ..< originalArray.count] print("subarray : \(subArray)") let indexB = subArray.index(of: 5)! print("index of #​5 : \(indexB)")
// output original array : [1, 2, 3, 4, 5, 6, 7] index of #​5 : 4 subarray : [4, 5, 6, 7] index of #​5 : 4
The last index should be 1 not 4.
The text was updated successfully, but these errors were encountered:
It's not a bug: https://developer.apple.com/documentation/swift/arrayslice
Sorry, something went wrong.
Comment by Joong Seok Lee (JIRA)
Thank you for help. I closed the issue.
No branches or pull requests
Environment
macOS 10.13.6 Xcode 10.1 Swift 4.2.1 / Swift 4.2 leetcode.com
Additional Detail from JIRA
md5: 5c598e7de23d1e53e35af4dbdd1cd08e
Issue Description:
Steps :
Create a subarray
Find the index of an item from the subarray
Problem :
It is returning the index from the original array.
The last index should be 1 not 4.
The text was updated successfully, but these errors were encountered: