Skip to content

Commit

Permalink
đŸ§¹Problem 003 refactoring and clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
jobearrr committed Jul 17, 2024
1 parent 31f2fac commit 148ad07
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LongestSubstringWithoutRepeatingCharactersDefinition.swift
// LongestSubstringWithUniqueCharsDefinition.swift
// LeetSwift
//
// Created by Jobert on 10/07/2024.
Expand All @@ -8,6 +8,6 @@
import Foundation
import Core

public protocol LongestSubstringWithoutRepeatingCharactersDefinition {
public protocol LongestSubstringWithUniqueCharsDefinition {
func lengthOfLongestSubstring(_ s: String) -> Int
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LongestSubstringWithoutRepeatingCharactersBruteForceSolution.swift
// LongestSubstringWithUniqueCharsBruteForceSolution.swift
// LeetSwift
//
// Created by Jobert on 10/07/2024.
Expand All @@ -9,7 +9,7 @@ import Core
import Foundation
import Problems

final class LongestSubstringWithoutRepeatingCharactersBruteForceSolution: LongestSubstringWithoutRepeatingCharactersDefinition {
final class LongestSubstringWithUniqueCharsBruteForceSolution: LongestSubstringWithUniqueCharsDefinition {

func lengthOfLongestSubstring(_ s: String) -> Int {
let chars = Array(s)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LongestSubstringWithoutRepeatingCharactersSlidingWindowSolution.swift
// LongestSubstringWithUniqueCharsSlidingWindowSolution.swift
// LeetSwift
//
// Created by Jobert on 10/07/2024.
Expand All @@ -9,7 +9,7 @@ import Core
import Foundation
import Problems

final class LongestSubstringWithoutRepeatingCharactersSlidingWindowSolution: LongestSubstringWithoutRepeatingCharactersDefinition {
final class LongestSubstringWithUniqueCharsSlidingWindowSolution: LongestSubstringWithUniqueCharsDefinition {

func lengthOfLongestSubstring(_ s: String) -> Int {
var indexMap = [Character: Int]()
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// LongestSubstringWithUniqueCharsBruteForceSolutionTests.swift
// LeetSwift
//
// Created by Jobert on 10/07/2024.
//

import XCTest
@testable import Problems
@testable import Solutions
@testable import TestSupport

final class LongestSubstringWithUniqueCharsBruteForceSolutionTests: XCTestCase {

let solution: LongestSubstringWithUniqueCharsDefinition = LongestSubstringWithUniqueCharsBruteForceSolution()

func testSolution() {
for testData in data {
let input = testData.input

let output = solution.lengthOfLongestSubstring(input)

XCTAssertEqual(output, testData.expectedOutput)
}
}
}

extension LongestSubstringWithUniqueCharsBruteForceSolutionTests: LongestSubstringWithUniqueCharsTestCaseProvider { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// LongestSubstringWithUniqueCharsSlidingWindowSolutionTests.swift
// LeetSwift
//
// Created by Jobert on 10/07/2024.
//

import XCTest
@testable import Problems
@testable import Solutions
@testable import TestSupport

final class LongestSubstringWithUniqueCharsSlidingWindowSolutionTests: XCTestCase {

let solution: LongestSubstringWithUniqueCharsDefinition = LongestSubstringWithUniqueCharsSlidingWindowSolution()

func testSolution() {
for testData in data {
let input = testData.input

let output = solution.lengthOfLongestSubstring(input)

XCTAssertEqual(output, testData.expectedOutput)
}
}
}

extension LongestSubstringWithUniqueCharsSlidingWindowSolutionTests: LongestSubstringWithUniqueCharsTestCaseProvider { }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LongestSubstringWithoutRepeatingCharactersTestCaseProvider.swift
// LongestSubstringWithUniqueCharsTestCaseProvider.swift
// LeetSwift
//
// Created by Jobert on 10/07/2024.
Expand All @@ -8,9 +8,9 @@
@testable import Core
@testable import TestSupport

protocol LongestSubstringWithoutRepeatingCharactersTestCaseProvider: TestCaseProviding { }
protocol LongestSubstringWithUniqueCharsTestCaseProvider: TestCaseProviding { }

extension LongestSubstringWithoutRepeatingCharactersTestCaseProvider {
extension LongestSubstringWithUniqueCharsTestCaseProvider {

func validateInput(_ s: String) -> Bool {
// TODO: Implement validation
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 148ad07

Please sign in to comment.