-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from raytso/dev/wei
Dev/wei
- Loading branch information
Showing
9 changed files
with
550 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// Solution.swift | ||
// TSWeiFramework | ||
// | ||
// Created by Wei Cao on 2019/2/19. | ||
// Copyright © 2019 Ray Tso. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public class Solution { | ||
public init(){} | ||
} | ||
|
||
//MARK:- Easy | ||
public extension Solution{ | ||
|
||
/** | ||
414, Third Maximum Number | ||
*/ | ||
func thirdMax(_ nums: [Int]) -> Int { | ||
let r = nums.reduce(into: (Int.min, Int.min, Int.min)) { (r, v) in | ||
switch v { | ||
case _ where v == r.0 || v == r.1 || v == r.2: | ||
break | ||
case _ where v > r.0: | ||
r = (v, r.0, r.1) | ||
case _ where v > r.1: | ||
(r.1, r.2) = (v, r.1) | ||
case _ where v > r.2: | ||
r.2 = v | ||
default: | ||
break | ||
} | ||
} | ||
return (r.2 == Int.min) ? r.0 : r.2 | ||
} | ||
|
||
/** | ||
844, Backspace String Compare | ||
*/ | ||
func backspaceCompare(_ S: String, _ T: String) -> Bool { | ||
return removeBackspace(S) == removeBackspace(T) | ||
} | ||
private func removeBackspace(_ s: String) -> String{ | ||
return s.reduce(into: "") { (r, c) in | ||
switch c { | ||
case _ where c != "#": | ||
r.append(c) | ||
case "#" where r.count > 0: | ||
_ = r.removeLast() | ||
default: | ||
break | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// TSWeiFramework.h | ||
// TSWeiFramework | ||
// | ||
// Created by Wei Cao on 2019/2/19. | ||
// Copyright © 2019 Ray Tso. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
//! Project version number for TSWeiFramework. | ||
FOUNDATION_EXPORT double TSWeiFrameworkVersionNumber; | ||
|
||
//! Project version string for TSWeiFramework. | ||
FOUNDATION_EXPORT const unsigned char TSWeiFrameworkVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <TSWeiFramework/PublicHeader.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// TSWeiFrameworkTests.swift | ||
// TSWeiFrameworkTests | ||
// | ||
// Created by Wei Cao on 2019/2/19. | ||
// Copyright © 2019 Ray Tso. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import TSWeiFramework | ||
|
||
class TSWeiFrameworkTests: XCTestCase { | ||
|
||
override func setUp() { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func testExample() { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct results. | ||
} | ||
|
||
func testPerformanceExample() { | ||
// This is an example of a performance test case. | ||
self.measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.