The Wayback Machine - https://web.archive.org/web/20201006052520/https://github.com/soapyigu/LeetCode-Swift/pull/262
Skip to content
New issue

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

[String] Add Solution to Buddy Strings #262

Open
wants to merge 9 commits into
base: master
from

Conversation

@zhyizhou
Copy link

@zhyizhou zhyizhou commented Sep 23, 2019

No description provided.

zhyizhou added 5 commits Sep 23, 2019
[String]Add Solution to Buddy Strings
Copy link
Owner

@soapyigu soapyigu left a comment

Hi thanks for the contribution! Could you also update the Progress session in README file?

String/BuddyStrings Outdated Show resolved Hide resolved
String/BuddyStrings Outdated Show resolved Hide resolved
String/BuddyStrings Outdated Show resolved Hide resolved
String/BuddyStrings Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
zhyizhou added 4 commits Oct 6, 2019
Edited code format;
@zhyizhou
Copy link
Author

@zhyizhou zhyizhou commented Oct 6, 2019

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 {

This comment has been minimized.

@wqfan

wqfan Oct 12, 2019
Contributor

Probably you don't want the whitespace before class.

@@ -0,0 +1,38 @@
/**

This comment has been minimized.

@wqfan

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.

/**
* Question Link: https://leetcode.com/problems/buddy-strings/
* Primary idea:
1. return false/tru for absolute cases

This comment has been minimized.

@wqfan

wqfan Oct 12, 2019
Contributor

Minor, there is a typo: return false/true.

if aLength != bLength || aLength == 0 {
return false
}
if A == B && Array(Set(A)).count != aLength {

This comment has been minimized.

@wqfan

wqfan Oct 12, 2019
Contributor

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 {

This comment has been minimized.

@wqfan

wqfan Oct 12, 2019
Contributor

I would say, a better practice in Swift would be:

for index in 0..<aLength

@soapyigu
Copy link
Owner

@soapyigu soapyigu commented May 11, 2020

Could you please resolve the merge conflict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.