├── DailyAlgorithm.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── zhengjiaohong.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── zhengjiaohong.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── DailyAlgorithm ├── ALGTableViewCell.swift ├── Algorithms.swift ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.swift ├── Tools.swift └── ViewController.swift └── README.md /DailyAlgorithm.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2F4DC8202B312A5800D45F9C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4DC81F2B312A5800D45F9C /* AppDelegate.swift */; }; 11 | 2F4DC8222B312A5800D45F9C /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4DC8212B312A5800D45F9C /* SceneDelegate.swift */; }; 12 | 2F4DC8242B312A5800D45F9C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4DC8232B312A5800D45F9C /* ViewController.swift */; }; 13 | 2F4DC8272B312A5800D45F9C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F4DC8252B312A5800D45F9C /* Main.storyboard */; }; 14 | 2F4DC8292B312A5900D45F9C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2F4DC8282B312A5900D45F9C /* Assets.xcassets */; }; 15 | 2F4DC82C2B312A5900D45F9C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F4DC82A2B312A5900D45F9C /* LaunchScreen.storyboard */; }; 16 | 2F4DC8342B31340B00D45F9C /* ALGTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4DC8332B31340B00D45F9C /* ALGTableViewCell.swift */; }; 17 | 2F4DC8362B31362500D45F9C /* Tools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4DC8352B31362500D45F9C /* Tools.swift */; }; 18 | 2F4DC8382B313B1600D45F9C /* Algorithms.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4DC8372B313B1600D45F9C /* Algorithms.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 2F4DC81C2B312A5800D45F9C /* DailyAlgorithm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DailyAlgorithm.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 2F4DC81F2B312A5800D45F9C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | 2F4DC8212B312A5800D45F9C /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 25 | 2F4DC8232B312A5800D45F9C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | 2F4DC8262B312A5800D45F9C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 2F4DC8282B312A5900D45F9C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 2F4DC82B2B312A5900D45F9C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 2F4DC82D2B312A5900D45F9C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 2F4DC8332B31340B00D45F9C /* ALGTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ALGTableViewCell.swift; sourceTree = ""; }; 31 | 2F4DC8352B31362500D45F9C /* Tools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tools.swift; sourceTree = ""; }; 32 | 2F4DC8372B313B1600D45F9C /* Algorithms.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Algorithms.swift; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 2F4DC8192B312A5800D45F9C /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 2F4DC8132B312A5800D45F9C = { 47 | isa = PBXGroup; 48 | children = ( 49 | 2F4DC81E2B312A5800D45F9C /* DailyAlgorithm */, 50 | 2F4DC81D2B312A5800D45F9C /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | 2F4DC81D2B312A5800D45F9C /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 2F4DC81C2B312A5800D45F9C /* DailyAlgorithm.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | 2F4DC81E2B312A5800D45F9C /* DailyAlgorithm */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 2F4DC81F2B312A5800D45F9C /* AppDelegate.swift */, 66 | 2F4DC8212B312A5800D45F9C /* SceneDelegate.swift */, 67 | 2F4DC8232B312A5800D45F9C /* ViewController.swift */, 68 | 2F4DC8332B31340B00D45F9C /* ALGTableViewCell.swift */, 69 | 2F4DC8352B31362500D45F9C /* Tools.swift */, 70 | 2F4DC8372B313B1600D45F9C /* Algorithms.swift */, 71 | 2F4DC8252B312A5800D45F9C /* Main.storyboard */, 72 | 2F4DC8282B312A5900D45F9C /* Assets.xcassets */, 73 | 2F4DC82A2B312A5900D45F9C /* LaunchScreen.storyboard */, 74 | 2F4DC82D2B312A5900D45F9C /* Info.plist */, 75 | ); 76 | path = DailyAlgorithm; 77 | sourceTree = ""; 78 | }; 79 | /* End PBXGroup section */ 80 | 81 | /* Begin PBXNativeTarget section */ 82 | 2F4DC81B2B312A5800D45F9C /* DailyAlgorithm */ = { 83 | isa = PBXNativeTarget; 84 | buildConfigurationList = 2F4DC8302B312A5900D45F9C /* Build configuration list for PBXNativeTarget "DailyAlgorithm" */; 85 | buildPhases = ( 86 | 2F4DC8182B312A5800D45F9C /* Sources */, 87 | 2F4DC8192B312A5800D45F9C /* Frameworks */, 88 | 2F4DC81A2B312A5800D45F9C /* Resources */, 89 | ); 90 | buildRules = ( 91 | ); 92 | dependencies = ( 93 | ); 94 | name = DailyAlgorithm; 95 | productName = DailyAlgorithm; 96 | productReference = 2F4DC81C2B312A5800D45F9C /* DailyAlgorithm.app */; 97 | productType = "com.apple.product-type.application"; 98 | }; 99 | /* End PBXNativeTarget section */ 100 | 101 | /* Begin PBXProject section */ 102 | 2F4DC8142B312A5800D45F9C /* Project object */ = { 103 | isa = PBXProject; 104 | attributes = { 105 | BuildIndependentTargetsInParallel = 1; 106 | LastSwiftUpdateCheck = 1500; 107 | LastUpgradeCheck = 1500; 108 | TargetAttributes = { 109 | 2F4DC81B2B312A5800D45F9C = { 110 | CreatedOnToolsVersion = 15.0; 111 | }; 112 | }; 113 | }; 114 | buildConfigurationList = 2F4DC8172B312A5800D45F9C /* Build configuration list for PBXProject "DailyAlgorithm" */; 115 | compatibilityVersion = "Xcode 14.0"; 116 | developmentRegion = en; 117 | hasScannedForEncodings = 0; 118 | knownRegions = ( 119 | en, 120 | Base, 121 | ); 122 | mainGroup = 2F4DC8132B312A5800D45F9C; 123 | productRefGroup = 2F4DC81D2B312A5800D45F9C /* Products */; 124 | projectDirPath = ""; 125 | projectRoot = ""; 126 | targets = ( 127 | 2F4DC81B2B312A5800D45F9C /* DailyAlgorithm */, 128 | ); 129 | }; 130 | /* End PBXProject section */ 131 | 132 | /* Begin PBXResourcesBuildPhase section */ 133 | 2F4DC81A2B312A5800D45F9C /* Resources */ = { 134 | isa = PBXResourcesBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | 2F4DC82C2B312A5900D45F9C /* LaunchScreen.storyboard in Resources */, 138 | 2F4DC8292B312A5900D45F9C /* Assets.xcassets in Resources */, 139 | 2F4DC8272B312A5800D45F9C /* Main.storyboard in Resources */, 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXResourcesBuildPhase section */ 144 | 145 | /* Begin PBXSourcesBuildPhase section */ 146 | 2F4DC8182B312A5800D45F9C /* Sources */ = { 147 | isa = PBXSourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | 2F4DC8342B31340B00D45F9C /* ALGTableViewCell.swift in Sources */, 151 | 2F4DC8242B312A5800D45F9C /* ViewController.swift in Sources */, 152 | 2F4DC8202B312A5800D45F9C /* AppDelegate.swift in Sources */, 153 | 2F4DC8222B312A5800D45F9C /* SceneDelegate.swift in Sources */, 154 | 2F4DC8362B31362500D45F9C /* Tools.swift in Sources */, 155 | 2F4DC8382B313B1600D45F9C /* Algorithms.swift in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin PBXVariantGroup section */ 162 | 2F4DC8252B312A5800D45F9C /* Main.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | 2F4DC8262B312A5800D45F9C /* Base */, 166 | ); 167 | name = Main.storyboard; 168 | sourceTree = ""; 169 | }; 170 | 2F4DC82A2B312A5900D45F9C /* LaunchScreen.storyboard */ = { 171 | isa = PBXVariantGroup; 172 | children = ( 173 | 2F4DC82B2B312A5900D45F9C /* Base */, 174 | ); 175 | name = LaunchScreen.storyboard; 176 | sourceTree = ""; 177 | }; 178 | /* End PBXVariantGroup section */ 179 | 180 | /* Begin XCBuildConfiguration section */ 181 | 2F4DC82E2B312A5900D45F9C /* Debug */ = { 182 | isa = XCBuildConfiguration; 183 | buildSettings = { 184 | ALWAYS_SEARCH_USER_PATHS = NO; 185 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 186 | CLANG_ANALYZER_NONNULL = YES; 187 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 189 | CLANG_ENABLE_MODULES = YES; 190 | CLANG_ENABLE_OBJC_ARC = YES; 191 | CLANG_ENABLE_OBJC_WEAK = YES; 192 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 193 | CLANG_WARN_BOOL_CONVERSION = YES; 194 | CLANG_WARN_COMMA = YES; 195 | CLANG_WARN_CONSTANT_CONVERSION = YES; 196 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 197 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 198 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 199 | CLANG_WARN_EMPTY_BODY = YES; 200 | CLANG_WARN_ENUM_CONVERSION = YES; 201 | CLANG_WARN_INFINITE_RECURSION = YES; 202 | CLANG_WARN_INT_CONVERSION = YES; 203 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 204 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 205 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 206 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 207 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 208 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 209 | CLANG_WARN_STRICT_PROTOTYPES = YES; 210 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 211 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 212 | CLANG_WARN_UNREACHABLE_CODE = YES; 213 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 214 | COPY_PHASE_STRIP = NO; 215 | DEBUG_INFORMATION_FORMAT = dwarf; 216 | ENABLE_STRICT_OBJC_MSGSEND = YES; 217 | ENABLE_TESTABILITY = YES; 218 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 219 | GCC_C_LANGUAGE_STANDARD = gnu17; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_NO_COMMON_BLOCKS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 17.0; 234 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 235 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 236 | MTL_FAST_MATH = YES; 237 | ONLY_ACTIVE_ARCH = YES; 238 | SDKROOT = iphoneos; 239 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; 240 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 241 | }; 242 | name = Debug; 243 | }; 244 | 2F4DC82F2B312A5900D45F9C /* Release */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 249 | CLANG_ANALYZER_NONNULL = YES; 250 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_ENABLE_OBJC_WEAK = YES; 255 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 256 | CLANG_WARN_BOOL_CONVERSION = YES; 257 | CLANG_WARN_COMMA = YES; 258 | CLANG_WARN_CONSTANT_CONVERSION = YES; 259 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 261 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 262 | CLANG_WARN_EMPTY_BODY = YES; 263 | CLANG_WARN_ENUM_CONVERSION = YES; 264 | CLANG_WARN_INFINITE_RECURSION = YES; 265 | CLANG_WARN_INT_CONVERSION = YES; 266 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 267 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 268 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 269 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 270 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 271 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 272 | CLANG_WARN_STRICT_PROTOTYPES = YES; 273 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 274 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 275 | CLANG_WARN_UNREACHABLE_CODE = YES; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | COPY_PHASE_STRIP = NO; 278 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 279 | ENABLE_NS_ASSERTIONS = NO; 280 | ENABLE_STRICT_OBJC_MSGSEND = YES; 281 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu17; 283 | GCC_NO_COMMON_BLOCKS = YES; 284 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 285 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 286 | GCC_WARN_UNDECLARED_SELECTOR = YES; 287 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 288 | GCC_WARN_UNUSED_FUNCTION = YES; 289 | GCC_WARN_UNUSED_VARIABLE = YES; 290 | IPHONEOS_DEPLOYMENT_TARGET = 17.0; 291 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 292 | MTL_ENABLE_DEBUG_INFO = NO; 293 | MTL_FAST_MATH = YES; 294 | SDKROOT = iphoneos; 295 | SWIFT_COMPILATION_MODE = wholemodule; 296 | VALIDATE_PRODUCT = YES; 297 | }; 298 | name = Release; 299 | }; 300 | 2F4DC8312B312A5900D45F9C /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 305 | CODE_SIGN_STYLE = Automatic; 306 | CURRENT_PROJECT_VERSION = 1; 307 | DEVELOPMENT_TEAM = VT73DARZRD; 308 | GENERATE_INFOPLIST_FILE = YES; 309 | INFOPLIST_FILE = DailyAlgorithm/Info.plist; 310 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 311 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 312 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 313 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 314 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 315 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 316 | LD_RUNPATH_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "@executable_path/Frameworks", 319 | ); 320 | MARKETING_VERSION = 1.0; 321 | PRODUCT_BUNDLE_IDENTIFIER = com.hong.DailyAlgorithm; 322 | PRODUCT_NAME = "$(TARGET_NAME)"; 323 | SWIFT_EMIT_LOC_STRINGS = YES; 324 | SWIFT_VERSION = 5.0; 325 | TARGETED_DEVICE_FAMILY = "1,2"; 326 | }; 327 | name = Debug; 328 | }; 329 | 2F4DC8322B312A5900D45F9C /* Release */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 333 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 334 | CODE_SIGN_STYLE = Automatic; 335 | CURRENT_PROJECT_VERSION = 1; 336 | DEVELOPMENT_TEAM = VT73DARZRD; 337 | GENERATE_INFOPLIST_FILE = YES; 338 | INFOPLIST_FILE = DailyAlgorithm/Info.plist; 339 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 340 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 341 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 342 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 343 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 344 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 345 | LD_RUNPATH_SEARCH_PATHS = ( 346 | "$(inherited)", 347 | "@executable_path/Frameworks", 348 | ); 349 | MARKETING_VERSION = 1.0; 350 | PRODUCT_BUNDLE_IDENTIFIER = com.hong.DailyAlgorithm; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | SWIFT_EMIT_LOC_STRINGS = YES; 353 | SWIFT_VERSION = 5.0; 354 | TARGETED_DEVICE_FAMILY = "1,2"; 355 | }; 356 | name = Release; 357 | }; 358 | /* End XCBuildConfiguration section */ 359 | 360 | /* Begin XCConfigurationList section */ 361 | 2F4DC8172B312A5800D45F9C /* Build configuration list for PBXProject "DailyAlgorithm" */ = { 362 | isa = XCConfigurationList; 363 | buildConfigurations = ( 364 | 2F4DC82E2B312A5900D45F9C /* Debug */, 365 | 2F4DC82F2B312A5900D45F9C /* Release */, 366 | ); 367 | defaultConfigurationIsVisible = 0; 368 | defaultConfigurationName = Release; 369 | }; 370 | 2F4DC8302B312A5900D45F9C /* Build configuration list for PBXNativeTarget "DailyAlgorithm" */ = { 371 | isa = XCConfigurationList; 372 | buildConfigurations = ( 373 | 2F4DC8312B312A5900D45F9C /* Debug */, 374 | 2F4DC8322B312A5900D45F9C /* Release */, 375 | ); 376 | defaultConfigurationIsVisible = 0; 377 | defaultConfigurationName = Release; 378 | }; 379 | /* End XCConfigurationList section */ 380 | }; 381 | rootObject = 2F4DC8142B312A5800D45F9C /* Project object */; 382 | } 383 | -------------------------------------------------------------------------------- /DailyAlgorithm.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DailyAlgorithm.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DailyAlgorithm.xcodeproj/project.xcworkspace/xcuserdata/zhengjiaohong.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snail-z/DailyAlgorithm/c8cdd5964747a916b36637544cbfcff912c88d0b/DailyAlgorithm.xcodeproj/project.xcworkspace/xcuserdata/zhengjiaohong.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DailyAlgorithm.xcodeproj/xcuserdata/zhengjiaohong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /DailyAlgorithm.xcodeproj/xcuserdata/zhengjiaohong.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DailyAlgorithm.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DailyAlgorithm/ALGTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALGTableViewCell.swift 3 | // DailyAlgorithm 4 | // 5 | // Created by zhang on 2023/12/19. 6 | // 7 | 8 | import UIKit 9 | 10 | class ALGTableViewCell: UITableViewCell { 11 | 12 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 13 | super.init(style: style, reuseIdentifier: reuseIdentifier) 14 | backgroundColor = .clear 15 | setup() 16 | } 17 | 18 | required init?(coder: NSCoder) { 19 | fatalError("init(coder:) has not been implemented") 20 | } 21 | 22 | lazy var messageLabel = { 23 | let label = UILabel() 24 | label.textColor = .blue 25 | label.font = ALGTableViewCell.titleFont() 26 | label.numberOfLines = .zero 27 | return label 28 | }() 29 | 30 | lazy var lineView = { 31 | let lineView = UIView() 32 | lineView.backgroundColor = UIColor.black.withAlphaComponent(0.2) 33 | return lineView 34 | }() 35 | 36 | func setup() { 37 | contentView.addSubview(messageLabel) 38 | contentView.addSubview(lineView) 39 | } 40 | 41 | override func layoutSubviews() { 42 | super.layoutSubviews() 43 | lineView.frame = CGRect(x: 0, y: bounds.height - 0.5, width: bounds.width, height: 1/UIScreen.main.scale) 44 | messageLabel.frame = CGRect(x: 15, y: 15, width: bounds.width - 30, height: bounds.height - 30) 45 | } 46 | } 47 | 48 | extension ALGTableViewCell { 49 | 50 | static func titleFont() -> UIFont { 51 | return UIFont(name: "pingFangSC-light", size: 18)! 52 | } 53 | 54 | static func cellHeight(title: String) -> CGFloat { 55 | let maxW = UIScreen.main.bounds.width - 30 56 | let height = title.boundingHeight(constraint: maxW, font: titleFont()) 57 | return height + 30 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /DailyAlgorithm/Algorithms.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Algorithms.swift 3 | // DailyAlgorithm 4 | // 5 | // Created by zhang on 2023/12/19. 6 | // 7 | 8 | import UIKit 9 | 10 | class Algorithms: NSObject { 11 | 12 | static let shared = Algorithms() 13 | 14 | func Log(_ message: String) { 15 | print("\n===============\(message)👇\n") 16 | } 17 | } 18 | 19 | extension Algorithms { 20 | 21 | func day1() { 22 | Log("两数之和") 23 | let nums = [2, 7, 11, 15] 24 | let target = 18 25 | 26 | let res = solution(nums: nums, target: target) 27 | print("res ==> \(res)") 28 | func solution(nums: [Int], target: Int) -> [Int] { 29 | var temps = [Int: Int]() 30 | for (index, element) in nums.enumerated() { 31 | if temps.keys.contains(target - element) { 32 | if let res = temps[target - element] { 33 | return [res, index] 34 | } 35 | } else { 36 | temps.updateValue(index, forKey: element) 37 | } 38 | } 39 | return [] 40 | } 41 | } 42 | 43 | func day2() { 44 | Log("最大数") 45 | 46 | let nums = [50, 201, 34, 9] 47 | // C++ 精髓:str_a+str_b > str_b+str_a 48 | print("stringValues======> \(largestNumber(nums))") 49 | 50 | func largestNumber(_ nums: [Int]) -> String { 51 | var values = nums 52 | values.sort { v1, v2 in 53 | return String(v1) + String(v2) > String(v2) + String(v1) 54 | } 55 | 56 | var res: String = "" 57 | for element in values { 58 | res += String(element) 59 | } 60 | return Int(res) == 0 ? "0" : res 61 | } 62 | 63 | 64 | comps(t1: 34, t2: 332) 65 | func comps(t1: Int, t2: Int) { 66 | // A拼接B > B拼接A,那么A在前,B在后 67 | // A拼接B = B拼接A,那么哪个前哪个后无所谓 68 | // A拼接B < B拼接A,那么B在前,A在后 69 | let temp1 = String(t1) + String(t2) 70 | let temp2 = String(t2) + String(t1) 71 | if temp1 > temp2 { 72 | print("temp1大: \(t1)") 73 | } else { 74 | print("temp2大: \(t2)") 75 | } 76 | } 77 | } 78 | } 79 | 80 | extension Algorithms { 81 | 82 | func day3() { 83 | Log("最后一个单词的长度") 84 | let str = " fly me to the moon " 85 | let len = lengthOfLastWord(str) 86 | print("len is: \(len)") 87 | 88 | func lengthOfLastWord(_ s: String) -> Int { 89 | // var len = 0 90 | // var isFlag = false 91 | // for element in s.unicodeScalars.reversed() { 92 | // if element.value == 32 { 93 | // guard isFlag else { continue } 94 | // return len 95 | // } else { 96 | // isFlag = true 97 | // len += 1 98 | // } 99 | // } 100 | // return len 101 | 102 | // var values = str.components(separatedBy: " ") 103 | // for element in values.reversed() { 104 | // guard element == "" else { 105 | // break 106 | // } 107 | // values.removeLast() 108 | // } 109 | // if let last = values.last { 110 | // return last.count 111 | // } 112 | // return .zero 113 | 114 | var len = 0 115 | var idx = s.count - 1 116 | while idx >= 0 { 117 | let c = (s as NSString).character(at: idx) 118 | if c == 32 { 119 | if len > 0 { break } 120 | } else { 121 | len += 1 122 | } 123 | idx -= 1 124 | } 125 | return len 126 | } 127 | } 128 | } 129 | 130 | extension Algorithms { 131 | 132 | func day4() { 133 | Log("加一") 134 | let digits = [1, 2, 3] 135 | let res = plusOne(digits) 136 | print("res is: \(res)") 137 | func plusOne(_ digits: [Int]) -> [Int] { 138 | 139 | var factor = 10 140 | var index = digits.count - 1 141 | var numbers = 0 142 | numbers += (digits[index] + 1) 143 | index -= 1 144 | 145 | while index >= 0 { 146 | numbers += digits[index] * factor 147 | factor *= 10 148 | index -= 1 149 | } 150 | 151 | var arrays = [Int]() 152 | while numbers > 0 { 153 | let p = numbers % 10 154 | arrays.append(p) 155 | numbers /= 10 156 | } 157 | 158 | var res = [Int]() 159 | 160 | for v in arrays.reversed() { 161 | 162 | res.append(v) 163 | } 164 | 165 | return res 166 | } 167 | } 168 | } 169 | 170 | extension Algorithms { 171 | 172 | func day5() { 173 | Log("最长公共前缀") 174 | let strs = ["flower","flow","flight"] 175 | let res = longestCommonPrefix(strs) 176 | print("res is: \(res)") 177 | func longestCommonPrefix(_ strs: [String]) -> String { 178 | 179 | return "" 180 | } 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /DailyAlgorithm/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DailyAlgorithm 4 | // 5 | // Created by zhang on 2023/12/19. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | // MARK: UISceneSession Lifecycle 21 | 22 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 23 | // Called when a new scene session is being created. 24 | // Use this method to select a configuration to create the new scene with. 25 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 26 | } 27 | 28 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 29 | // Called when the user discards a scene session. 30 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 31 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 32 | } 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /DailyAlgorithm/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DailyAlgorithm/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DailyAlgorithm/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /DailyAlgorithm/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DailyAlgorithm/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /DailyAlgorithm/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIApplicationSceneManifest 6 | 7 | UIApplicationSupportsMultipleScenes 8 | 9 | UISceneConfigurations 10 | 11 | UIWindowSceneSessionRoleApplication 12 | 13 | 14 | UISceneConfigurationName 15 | Default Configuration 16 | UISceneDelegateClassName 17 | $(PRODUCT_MODULE_NAME).SceneDelegate 18 | UISceneStoryboardFile 19 | Main 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DailyAlgorithm/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // DailyAlgorithm 4 | // 5 | // Created by zhang on 2023/12/19. 6 | // 7 | 8 | import UIKit 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | guard let _ = (scene as? UIWindowScene) else { return } 20 | } 21 | 22 | func sceneDidDisconnect(_ scene: UIScene) { 23 | // Called as the scene is being released by the system. 24 | // This occurs shortly after the scene enters the background, or when its session is discarded. 25 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 26 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 27 | } 28 | 29 | func sceneDidBecomeActive(_ scene: UIScene) { 30 | // Called when the scene has moved from an inactive state to an active state. 31 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 32 | } 33 | 34 | func sceneWillResignActive(_ scene: UIScene) { 35 | // Called when the scene will move from an active state to an inactive state. 36 | // This may occur due to temporary interruptions (ex. an incoming phone call). 37 | } 38 | 39 | func sceneWillEnterForeground(_ scene: UIScene) { 40 | // Called as the scene transitions from the background to the foreground. 41 | // Use this method to undo the changes made on entering the background. 42 | } 43 | 44 | func sceneDidEnterBackground(_ scene: UIScene) { 45 | // Called as the scene transitions from the foreground to the background. 46 | // Use this method to save data, release shared resources, and store enough scene-specific state information 47 | // to restore the scene back to its current state. 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /DailyAlgorithm/Tools.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tools.swift 3 | // DailyAlgorithm 4 | // 5 | // Created by zhang on 2023/12/19. 6 | // 7 | 8 | import UIKit 9 | 10 | public extension String { 11 | 12 | /// 将String转NSString 13 | func toNSString() -> NSString { 14 | return self as NSString 15 | } 16 | 17 | /// 获取字符串尺寸 (约束最大布局尺寸) 18 | func boundingSize(constraint size: CGSize, attributes: [NSAttributedString.Key: Any]?) -> CGSize { 19 | let size = toNSString().boundingRect( 20 | with: size, 21 | options: [.usesFontLeading, .usesLineFragmentOrigin], 22 | attributes: attributes, context: nil 23 | ).size 24 | return CGSize(width: ceil(size.width), height: ceil(size.height)) 25 | } 26 | 27 | /// 获取字符串尺寸 (设置字体、行高、省略模式) 28 | func boundingSize(constraint size: CGSize, font: UIFont!) -> CGSize { 29 | let fontValue = font ?? UIFont.systemFont(ofSize: UIFont.systemFontSize) 30 | let attributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: fontValue] 31 | return boundingSize(constraint: size, attributes: attributes) 32 | } 33 | 34 | /// 获取字符串宽度 (约束高度) 35 | func boundingWidth(constraint height: CGFloat, attributes: [NSAttributedString.Key: Any]?) -> CGFloat { 36 | let size = CGSize(width: .greatestFiniteMagnitude, height: height) 37 | return boundingSize(constraint: size, attributes: attributes).width 38 | } 39 | 40 | /// 获取字符串宽度 (约束高度) 41 | func boundingWidth(constraint height: CGFloat, font: UIFont!) -> CGFloat { 42 | let size = CGSize(width: .greatestFiniteMagnitude, height: height) 43 | return boundingSize(constraint: size, font: font).width 44 | } 45 | 46 | /// 获取字符串高度 (约束宽度) 47 | func boundingHeight(constraint width: CGFloat, attributes: [NSAttributedString.Key: Any]?) -> CGFloat { 48 | let size = CGSize(width: width, height: .greatestFiniteMagnitude) 49 | return boundingSize(constraint: size, attributes: attributes).height 50 | } 51 | 52 | /// 获取字符串高度 (约束宽度) 53 | func boundingHeight(constraint width: CGFloat, font: UIFont!) -> CGFloat { 54 | let size = CGSize(width: width, height: .greatestFiniteMagnitude) 55 | return boundingSize(constraint: size, font: font).height 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /DailyAlgorithm/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DailyAlgorithm 4 | // 5 | // Created by zhang on 2023/12/19. 6 | // 7 | 8 | import UIKit 9 | 10 | class ViewController: UIViewController { 11 | 12 | override func viewDidLoad() { 13 | super.viewDidLoad() 14 | 15 | view.addSubview(tableView) 16 | } 17 | 18 | lazy var titles: [String] = { 19 | return ["1.两数之和", "2.最大数", "3.最后一个单词的长度", "4.加一", "最长公共前缀"] 20 | }() 21 | 22 | lazy var tableView = { 23 | let tableView = UITableView(frame: view.bounds, style: .plain) 24 | tableView.backgroundColor = .clear 25 | tableView.bounces = true 26 | tableView.dataSource = self 27 | tableView.delegate = self 28 | tableView.separatorStyle = .none 29 | tableView.tableFooterView = UIView() 30 | tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 80, right: 0) 31 | return tableView 32 | }() 33 | } 34 | 35 | extension ViewController: UITableViewDelegate, UITableViewDataSource { 36 | 37 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 38 | return titles.count 39 | } 40 | 41 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 42 | var cell = tableView.dequeueReusableCell(withIdentifier: "cell") as? ALGTableViewCell 43 | if cell == nil { 44 | cell = ALGTableViewCell(style: .default, reuseIdentifier: "cell") 45 | } 46 | cell?.messageLabel.text = titles[indexPath.row] 47 | return cell! 48 | } 49 | 50 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 51 | let title = titles[indexPath.row] 52 | return ALGTableViewCell.cellHeight(title: title) 53 | } 54 | 55 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 56 | tableView.deselectRow(at: indexPath, animated: true) 57 | let obj = Algorithms.shared 58 | switch (indexPath.row + 1) { 59 | case 1: obj.day1() 60 | case 2: obj.day2() 61 | case 3: obj.day3() 62 | case 4: obj.day4() 63 | case 5: obj.day5() 64 | default: break 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 算法题-每日打卡 2 | --------------------------------------------------------------------------------