Skip to content

Commit

Permalink
Merge pull request soapyigu#357 from mertlsarac/master
Browse files Browse the repository at this point in the history
updated solution for multiplyStrings
  • Loading branch information
soapyigu authored Oct 18, 2022
2 parents 89640c0 + d8bcc6f commit 2d0166c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions String/MultiplyStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ class MultiplyStrings {
// calculate product for every digit
for (i, char1) in num1.enumerated() {

guard let digit1 = Int(String(char1)) else {
guard let digit1 = char1.wholeNumberValue else {
fatalError("Invalid Input num1")
}

for (j, char2) in num2.enumerated() {
guard let digit2 = Int(String(char2)) else {
guard let digit2 = char2.wholeNumberValue else {
fatalError("Invalid Input num2")
}

Expand All @@ -44,7 +44,7 @@ class MultiplyStrings {
}

// trim starting 0s
while !resStr.isEmpty && resStr.first! == "0" {
while resStr.first == "0" {
resStr.removeFirst()
}

Expand Down

0 comments on commit 2d0166c

Please sign in to comment.