Swift solution Algorithms/challenges/tr/tr.md#123
Swift solution Algorithms/challenges/tr/tr.md#123marsikeda wants to merge 1 commit intoWomenWhoCodeNYC:masterfrom
Conversation
func tr(from: String, to: String, test: String) -> String {
var fromArray = Array(from.characters)
var toArray = Array(to.characters)
let testArray = Array(test.characters)
var testDictionary: [String : String] = [:]
var stupidNewArray: [String] = []
var result: String = ""
if fromArray.count != toArray.count {
return "Bad from/to string"
}
for char in 0..<fromArray.count {
testDictionary[String(fromArray[char])] = String(toArray[char])
}
for char in testArray {
if testDictionary.keys.contains(String(char)) {
stupidNewArray.append(testDictionary[String(char)]!)
}
else {
stupidNewArray.append(String(char))
}
}
for letter in stupidNewArray {
result += letter
}
return result
}
|
cool solution! 💯 Do you think you'd be able to put your solution file into a solutions folder for the particular challenge? So for the tr problem there already is a solutions folder here: https://github.com/WomenWhoCodeNYC/Algorithms/tree/master/challenges/tr If you move the file on your local machine to solutions folder and recommit it and push, it should update your pr automatically! If you run into any problems let me know and I can help out. Nice job! 🥇 |
|
Thank you! Quick question: I did everything up until making the push—do I
do that from Github or does it have to be done from the command line? I'm
still learning Github ;-)
…On Wed, Jan 18, 2017 at 9:21 AM, Sarah Zinger ***@***.***> wrote:
cool solution! 💯 Do you think you'd be able to put your solution file
into a solutions folder for the particular challenge? So for the tr problem
there already is a solutions folder here: https://github.com/
WomenWhoCodeNYC/Algorithms/tree/master/challenges/tr
If you move the file on your local machine to solutions folder and
recommit it and push, it should update your pr automatically! If you run
into any problems let me know and I can help out.
Nice job! 🥇
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATOTZ-yC9RnzttFedz_7ro674CFNa8Xxks5rTiAAgaJpZM4Lmeop>
.
|
|
@MGTEI you can make it from the command line on your branch that you've made and your pull request will automatically update. Give it a shot and if it doesn't work as expected, don't worry just let me know, whatever happens we can fix it 😄 Way to go practicing github !🎈 Next time you make a pr you might want to check out this guide we made which might have some helpful hints! |
func tr(from: String, to: String, test: String) -> String {
var fromArray = Array(from.characters)
var toArray = Array(to.characters)
let testArray = Array(test.characters)
var testDictionary: [String : String] = [:]
var stupidNewArray: [String] = []
var result: String = ""
if fromArray.count != toArray.count {
return "Bad from/to string"
}
for char in 0..<fromArray.count {
testDictionary[String(fromArray[char])] = String(toArray[char])
}
}