Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[String] Add Solution to Buddy Strings #262
Conversation
Hi thanks for the contribution! Could you also update the |
Hi soapyigu, thanks for your reply. All resolved as requested, please review again. Thanks. |
* Memory Usage: 23.3 MB, less than 100.00% of Swift online submissions for Buddy Strings. | ||
*/ | ||
|
||
class BuddyStrings { |
wqfan
Oct 12, 2019
Contributor
Probably you don't want the whitespace before class
.
Probably you don't want the whitespace before class
.
@@ -0,0 +1,38 @@ | |||
/** |
wqfan
Oct 12, 2019
Contributor
It's strange that this file doesn't have a .swift
file extension. However, you included .swift
in the README. I believe that the link is broken.
It's strange that this file doesn't have a .swift
file extension. However, you included .swift
in the README. I believe that the link is broken.
/** | ||
* Question Link: https://leetcode.com/problems/buddy-strings/ | ||
* Primary idea: | ||
1. return false/tru for absolute cases |
wqfan
Oct 12, 2019
Contributor
Minor, there is a typo: return false/true.
Minor, there is a typo: return false/true.
if aLength != bLength || aLength == 0 { | ||
return false | ||
} | ||
if A == B && Array(Set(A)).count != aLength { |
wqfan
Oct 12, 2019
Contributor
You don't have to convert the Set
to Array
to get the count, right?
You don't have to convert the Set
to Array
to get the count, right?
} | ||
let aArray = Array(A), bArray = Array(B) | ||
var diff = [Character]() | ||
for index in 0...aLength-1 { |
wqfan
Oct 12, 2019
Contributor
I would say, a better practice in Swift would be:
for index in 0..<aLength
I would say, a better practice in Swift would be:
for index in 0..<aLength
Could you please resolve the merge conflict? |
No description provided.